这是一个非常奇怪的问题,我不知道在哪里可以找到解决方案。
执行 POST 请求,我可以从“file_get_contents('php://input')”获取请求参数。$_SERVER 变量也不为空。它包含数据。但无论 URL 中是否存在参数,$_GET 始终为空。$_SERVER["QUERY_STRING"] 对于 GET 请求方法也是空的。
我不知道如何解决这个问题。我尝试在严格和非严格模式下访问 $_GET 。总是同样的问题。可能缺少标题吗?这是我的要求和回应如下:
Remote Address:xxx.xxx.xx.xx:80
Request URL:http://local.mysite.com/?foo=bar
Request Method:GET
Status Code:200 OK
Response Headers
Access-Control-Allow-Credentials:true
Access-Control-Allow-Methods:GET, HEAD, POST, PUT, DELETE
Connection:keep-alive
Content-Encoding:gzip
Content-Type:application/json
Date:Wed, 15 Apr 2015 09:11:51 GMT
Server:nginx/1.4.6 (Ubuntu)
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-Powered-By:HHVM/3.6.0-dev
Request Headers
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:sv-SE,sv;q=0.8,en-US;q=0.6,en;q=0.4,da;q=0.2,nb;q=0.2,de;q=0.2
Cache-Control:max-age=0
Connection:keep-alive
Host:local.mysite.com
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36
Query String Parameters
foo:bar