时间:2021-07-01 10:21:17 帮助过:32人阅读
//实例化上传类
public function upload() {
$upload = new Upload();
$upload->maxSize = 10 * 1024 * 1024;
$upload->exts = array('jpg', 'jpeg', 'gif', 'txt','zip');
$upload->savePath = './';
$upload->hash = false;
$info = $upload->upload();
if (!$info) {
$this->error($upload->getError());
}
else{
foreach ($info as $file) {
$uploadFile=$file['savepath'].$file['savename'];
echo $uploadFile;
}
}
}
//添加文章
public function addArticle(){
$sort = $_POST['sort'];
$title = $_POST['title'];
$intro = $_POST['intro'];
$pic = $_POST['pic'];
$content = $_POST['content'];
$articleSort= D('Article')->addArticle($sort,$title,$intro,$pic,$content);
$this->display('Index/AddArticle');
}