>  Q&A  >  본문

exit()能输入错误内容,却不能return,求指教

    /**
     *显示错误
     */
    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_u1088phpcn_u10882754일 전968

모든 응답(2)나는 대답할 것이다

  • 数据分析师

    数据分析师2017-10-01 00:44:21

    exit()에 잘못된 내용을 입력했는데 돌아올 수 없습니다. 조언 부탁드립니다-PHP 중국어 사이트 Q&A-exit()에서 잘못된 내용을 입력했지만 돌아올 수 없습니다. 조언 좀 주세요-PHP 중국어 사이트 Q&A

    보시고 배우시기 바랍니다.

    회신하다
    0
  • PHPz

    PHPz2017-03-10 09:27:07

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

    회신하다
    0
  • 취소회신하다