doudan1123 2015-04-15 09:18
浏览 62
已采纳

查询字符串参数丢失

This is a really weird issue which I don't know where to find the solution.

Doing a POST request I could get the request parameters from "file_get_contents('php://input')". Also the $_SERVER variable is not empty. It contains data. But $_GET is always empty regardless if parameters exist in URL or not. $_SERVER["QUERY_STRING"] is also empty with GET request method.

I don't know how to solve this. I've tried to access $_GET in strict as well as non-strict mode. Same problem always. Could there be headers missing? This is my request and response below:

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
  • 写回答

1条回答 默认 最新

  • dongyinzhi4689 2015-04-15 09:28
    关注

    Is it possible that you have a rewrite rule (i.e. something similar to mod_rewrite or mod_proxy) that is not populating the GET ?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容