金牌教父
2017-03-09 21:30
/**
*显示错误
*/
protected function showError(){
// exit('<span style="color:red">'.$this->error.'</span>');
return $this->error;
}
/**
* 上传文件
* @return string
*/
public function uploadFile(){
if($this->checkError()&&$this->checkSize()&&$this->checkExt()&&$this->checkMime()&&$this->checkTrueImg()&&$this->checkHTTPPost()){
$this->checkUploadPath();
$this->uniName=$this->getUniName();
$this->destination=$this->uploadPath.'/'.$this->uniName.'.'.$this->ext;
$this->newfile=$this->uniName.'.'.$this->ext;
if(@move_uploaded_file($this->fileInfo['tmp_name'], $this->destination)){
// return $this->destination;
return array ($this->uniName.'.'.$this->ext);
}else{
$this->error='文件移动失败';
$this->showError();
}
}else{
$this->showError();
}
}
你return完之后要输出是在你实例化类后输出的
PHP实现文件上传与下载
43735 学习 · 328 问题
相似问题