exit()能输入错误内容,却不能return,求指教
phpcn_u1088
phpcn_u1088 2017-03-09 21:25:14
0
2
964

    /**
     *显示错误
     */
    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();
        }
    }

phpcn_u1088
phpcn_u1088

全部回覆(2)
数据分析师

exit()能輸入錯誤內容,卻不能return,求指教-PHP中文網問答-exit()能輸入錯誤內容,卻不能return,求指教-PHP中文網問答

#圍觀一下哦,學習一下。

PHPzhong

exit() 函数输出一条消息,并退出当前脚本。

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!