PHP完全自学手册(珍藏版) 中文pdf扫描版下载
Controller代码:(包括增、改、删)
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public
function
actionCreate()
{
$model
=
new
CompanyNews;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if
(isset(
$_POST
[
'CompanyNews'
]))
{
$model
->attributes=
$_POST
[
'CompanyNews'
];
if
(
empty
(
$_POST
[
'CompanyNews'
][
'news_pic'
])){
$model
->news_pic =
$model
->news_pic;
}
$file
= CUploadedFile::getInstance(
$model
,
'news_pic'
);
//获得一个CUploadedFile的实例