2015-04-15 116 views
1

這是一個非常奇怪的問題,我不知道在哪裏可以找到解決方案。查詢字符串參數丟失

做POST請求我可以從「file_get_contents('php:// input')」獲取請求參數。另外$ _SERVER變量不是空的。它包含數據。但是$ _GET總是空的,無論參數是否存在於URL中。使用GET請求方法時,$ _SERVER [「QUERY_STRING」]也爲空。

我不知道如何解決這個問題。我試圖以嚴格和非嚴格模式訪問$ _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 

回答

0

有沒有可能是你有一個重寫規則(即類似於mod_rewrite的或mod_proxy的東西)未填充得到什麼?

+0

這可能是它!這麼簡單...我實際上有一個Nginx的conf可能是問題。我會研究這一點。我討厭拉我的頭髮這樣明顯的錯誤:) – musse1

+0

這是如此愚蠢:「try_files $ uri $ uri//index.hh;」。感謝您指點我正確的方向! 解決方案:「try_files $ uri $ uri//index.hh?$query_string;」 – musse1