[ 返回上级目录]1:打开后台 public 目录,在该目录内搜索 .php 文件,如果搜索到,只留下 index.php,其他的php文件全部删除;
2:运营时 env 文件内的 APP_DEBUG=true 必须修改为 APP_DEBUG=false,否则可能造成安全隐患;
3:数据库信息修改复杂一点,数据库默认端口建议改掉;
4:打开后台 routes 目录,如果存在 api2.php 文件,则删除该文件;
5:打开 api.php 找到大概53行左右,看到该行代码: Route::post('/uploadimg','Api\AuthController@uploadimg'); 删除该行;
6:打开后台目录 app\Http\Controllers\Api\AuthController.php 打开该文件找到大概754行左右;
如果存在以下代码:
public function uploadimg(Request $request) { $token = $request->header('authorization'); $token = str_replace('Bearer ','',$token) ; $user = User::where('api_token',$token)->first(); $data = $request->all(); \Illuminate\Support\Facades\Log::info("上传回调结果"); \Illuminate\Support\Facades\Log::info($_FILES); \Illuminate\Support\Facades\Log::info(json_encode($_FILES)); $filename=$_FILES['file']['name']; $type=$_FILES['file']['type']; // echo $type; $fileTypes = array('image/png','image/jpg','image/jpeg'); if (!in_array($type,$fileTypes)){ return $this->returnMsg(201,'','上传失败'); } $tmp_name=$_FILES['file']['tmp_name']; $size=$_FILES['file']['size']; $error=$_FILES['file']['error']; $temp = explode('.',$filename); $name = $temp[0]; $typePic = $temp[1]; $filename = time().".".$typePic; $save = '/uploads/avatar/'.basename($filename); $stored_path = APPPATH.$save; $res = move_uploaded_file($tmp_name, $stored_path); $httpsStr = env('APP_URL'); $stored_path = $httpsStr.$save; $user->avatar = $save; $rest = $user->save(); //$rest = $this->uploadImgSql($types,$stored_path,$user_id,$rid); if ($rest){ echo $stored_path; }else{ echo ''; } }上面代码全部删除