简体   繁体   English

无法获取网址参数

[英]Can't get URL paramaters

Laravel 4.1, PHP 5.4 Laravel 4.1,PHP 5.4

My route looks like this: 我的路线如下所示:

Route::get('maps', function(){
    dd(Input::all());
});

The URL I load in the browser is this: 我在浏览器中加载的URL是这样的:

http://ag-aus.dev/maps?type=ctf

I'm expecting to get the value of "type" which is "ctf". 我期望得到“ type”的值是“ ctf”。

But the response I get is this: 但是我得到的响应是这样的:

array(0) {
}

I'm sure this used to work, but I have no idea why this is happening. 我敢肯定这曾经有用,但是我不知道为什么会这样。

var_dump($_GET); also returns an empty array. 还返回一个空数组。

Nginx config was not setup to pass the queries to laravel. Nginx配置未设置为将查询传递给laravel。

UPDATE UPDATE

I was missing the ?$query_string parameter in my nginx site config file. 我在Nginx站点配置文件中缺少?$query_string参数。

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

Source: http://laravel.com/docs/4.2/installation#pretty-urls 来源: http//laravel.com/docs/4.2/installation#pretty-urls

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM