1
我有laravel一个问题,即查询字符串显示空:Laravel 5.2查询字符串是空的
如果我/ EN /新闻/一些新闻,蛞蝓,它得到的输入需要。但是,如果我的/ en/news?page = 2,它并不表明我有'页'查询字符串参数。这里是我的nginx的配置:
conf.d/php.conf
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
服务器:
server {
listen 80;
# root and servername hidden
location/{
try_files $uri $uri/ /index.php$args;
}
index index.php;
include conf.d/php.conf;
}
控制器:
public function index(Request $request)
{
var_dump($request->query());
$posts = $this->post->paginate(App::getLocale(), 2);
foreach($posts as $post) {
echo $post->id. ' ';
}
die;
}
如果你想查询字符串变量“页面”,你应该找'$请求 - > page'或'$请求 - >输入(“页”)' 。那两个都能得到正确的变量? –