首頁 > 後端開發 > php教程 > ngnix - php取不到$_GET的值是怎麼回事?

ngnix - php取不到$_GET的值是怎麼回事?

WBOY
發布: 2016-09-02 08:57:05
原創
1309 人瀏覽過

在本機開發時是沒有異常的,部署到伺服器就各種問題了,REQUEST_URI的參數明明是有值的,但是QUERY_STRING卻是空的...orz
在本機開發時是用apache,部署是用ngnix難道和設定有關?

<code>array:32 [▼
  "USER" => "www-data"
  "HOME" => "/var/www"
  "FCGI_ROLE" => "RESPONDER"
  "QUERY_STRING" => ""
  "REQUEST_METHOD" => "GET"
  "CONTENT_TYPE" => ""
  "CONTENT_LENGTH" => ""
  "SCRIPT_FILENAME" => "/home/ubuntu/mfphp/index.php"
  "SCRIPT_NAME" => "/index.php"
  "REQUEST_URI" => "/Index/test/?id=3&page=1&size=10"
  "DOCUMENT_URI" => "/index.php"
  "DOCUMENT_ROOT" => "/home/ubuntu/mfphp"
  "SERVER_PROTOCOL" => "HTTP/1.1"
  "GATEWAY_INTERFACE" => "CGI/1.1"
  "SERVER_SOFTWARE" => "nginx/1.4.6"
  "REMOTE_ADDR" => "223.73.98.45"
  "REMOTE_PORT" => "23487"
  "SERVER_ADDR" => "10.104.44.175"
  "SERVER_PORT" => "80"
  "SERVER_NAME" => "gb.qiangtaoli.com"
  "REDIRECT_STATUS" => "200"
  "HTTP_HOST" => "gb.qiangtaoli.com"
  "HTTP_CONNECTION" => "keep-alive"
  "HTTP_CACHE_CONTROL" => "max-age=0"
  "HTTP_UPGRADE_INSECURE_REQUESTS" => "1"
  "HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
  "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
  "HTTP_ACCEPT_ENCODING" => "gzip, deflate, sdch"
  "HTTP_ACCEPT_LANGUAGE" => "zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4"
  "PHP_SELF" => "/index.php"
  "REQUEST_TIME_FLOAT" => 1472734757.8597
  "REQUEST_TIME" => 1472734757
]</code>
登入後複製
登入後複製

回覆內容:

在本機開發時是沒有異常的,部署到伺服器就各種問題了,REQUEST_URI的參數明明是有值的,但是QUERY_STRING卻是空的...orz
在本機開發時是用apache,部署是用ngnix難道和設定有關?

<code>array:32 [▼
  "USER" => "www-data"
  "HOME" => "/var/www"
  "FCGI_ROLE" => "RESPONDER"
  "QUERY_STRING" => ""
  "REQUEST_METHOD" => "GET"
  "CONTENT_TYPE" => ""
  "CONTENT_LENGTH" => ""
  "SCRIPT_FILENAME" => "/home/ubuntu/mfphp/index.php"
  "SCRIPT_NAME" => "/index.php"
  "REQUEST_URI" => "/Index/test/?id=3&page=1&size=10"
  "DOCUMENT_URI" => "/index.php"
  "DOCUMENT_ROOT" => "/home/ubuntu/mfphp"
  "SERVER_PROTOCOL" => "HTTP/1.1"
  "GATEWAY_INTERFACE" => "CGI/1.1"
  "SERVER_SOFTWARE" => "nginx/1.4.6"
  "REMOTE_ADDR" => "223.73.98.45"
  "REMOTE_PORT" => "23487"
  "SERVER_ADDR" => "10.104.44.175"
  "SERVER_PORT" => "80"
  "SERVER_NAME" => "gb.qiangtaoli.com"
  "REDIRECT_STATUS" => "200"
  "HTTP_HOST" => "gb.qiangtaoli.com"
  "HTTP_CONNECTION" => "keep-alive"
  "HTTP_CACHE_CONTROL" => "max-age=0"
  "HTTP_UPGRADE_INSECURE_REQUESTS" => "1"
  "HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
  "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
  "HTTP_ACCEPT_ENCODING" => "gzip, deflate, sdch"
  "HTTP_ACCEPT_LANGUAGE" => "zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4"
  "PHP_SELF" => "/index.php"
  "REQUEST_TIME_FLOAT" => 1472734757.8597
  "REQUEST_TIME" => 1472734757
]</code>
登入後複製
登入後複製

<code class="php">
phpinfo();
</code>
登入後複製

看看有沒有value

在看php.ini 中:variables_order 的值。 修改成為這樣就OK了

<code class="php">variables_order="EGPCS"</code>
登入後複製
相關標籤:
php
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板