前台发送的是一个formdata数据 里面有files和json数据 laravel后台这样获取参数的
$file= $request->all();
dd($file);
下面是线上和线下用$request->all()获取到的数据 为什么线上获取到的是三个参数 多了一个当前路由的地址 而本地测试获取到的是两个参数呢?
线上
线下
nginx配置
server{
listen 80;
server_name www.domain.com;
return 301 https://domain.com$uri;
}
server {
server_name domain.com;
client_max_body_size 20M;
listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/ssl/1_domain.com_bundle.crt;
ssl_certificate_key /etc/nginx/ssl/2_domain.com.key;
set $root_path '/var/www/html/blog/public';
root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index /index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
安装 |《Laravel 5.5 中文文档》| Laravel China 社区