我遇到一个奇怪的问题,即$_GET
(和$_REQUEST
)变量是空的,即使正在传递的参数。
我的PHP代码:
echo $_SERVER['REQUEST_URI'];
echo print_r($_REQUEST);
echo print_r($_GET);
输出:
/service/getAllOrders?sortBy=date_created&sortDir=desc
Array()
Array()
我使用nginx的,并转发到index.php的所有请求。 我的配置如下:
server {
listen 80;
server_name decaro.localhost;
root /Users/rweiss/Sites/decaro/LocalOrderWebsite;
#access_log /usr/local/etc/nginx/logs/default.access.log main;
location / {
add_header Cache-Control "no-cache, no-store";
include /usr/local/etc/nginx/conf.d/php-fpm;
try_files $uri $uri/ /index.php$args;
}
location /assets/ {
allow all;
}
location = /info {
allow 127.0.0.1;
deny all;
rewrite (.*) /.info.php;
}
error_page 404 /404.html;
error_page 403 /403.html;
}
为什么?