$this->uploads($picurl); public function uploads($picurl) { $config = array( 'maxSize' => 3145728, 'exts' => array('jpg','png','gif','jpeg'), 'rootPath' => './Public/', 'savePath' => 'Admin/img/', 'saveName' => '', 'autoSub' => true, 'subName' => array('date','Ymd'), ); $uploads = new \Think\Upload($config); $result = $uploads->uploadOne($picurl); //$result->$uploads->upload(); if(!$result) { $info = $uploads->getError(); } else { $info = __ROOT__.'/Public/'.$result['savepath'].$result['savename']; } return $info; } //調用upload上傳文件有單文件上傳跟多文件上傳兩種,可是將其封裝成一個類傳參數調用的時候,uploadOne($picurl)方法必須寫傳進來的參數,而upload()方法不能寫傳進來的參數,會顯示非法上傳文件!!! //返回信息使用uploadOne()方法不須要遍歷,使用upload()方法必須遍歷