laravel 文件上传 & 跨域 发表于 2020-03-30 | 分类于 技术跨域框架路由部分,route.php,允许跨域12345Route::group(['prefix' => 'wechat', 'namespace' => 'Wechat'], function() { header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS"); header("Access-Control-Allow-Headers: content-type,authorization");});文件上传12345678#获取上传临时文件$file=$request->file('img');#获取文件名$filename=$file->getClientOriginalName();#复制文件至存储目录$path = $request->file('img')->store('/public');