【发布时间】:2015-01-16 17:02:35
【问题描述】:
我正在使用 laravel 4.2 和 nginx,通过简单的 Get 路由,我无法使用 'Input::get('id') 访问查询参数' 。如果我尝试 Request::fullUrl(),即使我提供了,我也看不到任何查询参数。
我的路线是:
Route::get('user' , 'UserController@show');
在我刚刚使用的控制器中,
Input::get('name');
并访问如下路线:
localhost/user?name=foo
Nginx 配置是:
server {
listen 80;
root /home/ubuntu/project/public;
index index.html index.php;
server_name localhost;
# set expiration of assets to MAX for caching
location ~* \.(html|ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}
location / {
# First attempt to server request as file, then
# as directory, then fall back to displaying a 404
try_files $uri $uri/ /index.php;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
error_page 404 /404.html;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_read_timeout 36000;
include fastcgi_params;
}
location /server-status {
stub_status on;
access_log off;
allow all;
}
}
【问题讨论】: