public function edit(){
$Article=D('Article');
$Articler=$Article->find(I('id'));
$this->assign('Articler',$Articler);
if(IS_POST){
$date['id']=I('id');
$date['title']=I('title');
$date['desc']=I('desc'); //判断是否有POST方式提交
$date['pic']=I('pic');
$date['content']=I('content');
$date['cateid']=I('cateid');
if($_FILES['pic']['tmp_name']!=''){
$upload = new \Think\Upload();// 实例化上传类
$upload->maxSize =3145728 ;// 设置附件上传大小
$upload->exts =array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
$upload->rootPath ='./'; // 设置附件上传根目录
$upload->savePath ='./Uploads/'; // 设置附件上传(子)目录
$info = $upload->uploadOne($_FILES['pic']);
// 上传文件
if(!$info) {// 上传错误提示错误信息
$this->error($upload->getError());
}else{// 上传成功
$date['pic']=$info['savepath'].$info['savename'];
}
}else{
}
if($文章->create($date)){
if($Article->save()){
$this->success("修改文章成功!",U('lst'), 3);
}else{
$this->error('修改文章失败!','',3);
}
}else{
$this-> error($Article->getError());
}
return;
}
$cateres=D('cate')->select();
$this->assign('cateres',$cateres);
$this->display();
}
<tr>