$_REQUEST為什麼是空的?

來源:互聯網
上載者:User
我的 php.ini 是這樣設定的:

variables_order = "EGPCS"
request_order =

request_order 留空的話不是會使用 variables_order 的值嗎?


回複討論(解決方案)

不知道你怎麼請求的,把你的請求流程說明一下。

request_order =GP
不是預設的get和post,設定為空白幹嘛?

不知道你怎麼請求的,把你的請求流程說明一下。

xxx.php?aaa=bbb

request_order 為空白的時候 $_REQUEST 是空數組,
request_order = "GP" 的時候 $_REQUEST 才有內容。


不知道你怎麼請求的,把你的請求流程說明一下。

xxx.php?aaa=bbb

request_order 為空白的時候 $_REQUEST 是空數組,
request_order = "GP" 的時候 $_REQUEST 才有內容。


這就對了,看request_order 的解釋,它設定的是$_REQUEST變數的設定和覆蓋順序。如果為空白,也就是$_REQUEST不包含P(Post),G(Get)和C(Cookie)變數了,自然就是空了



不知道你怎麼請求的,把你的請求流程說明一下。

xxx.php?aaa=bbb

request_order 為空白的時候 $_REQUEST 是空數組,
request_order = "GP" 的時候 $_REQUEST 才有內容。


這就對了,看request_order 的解釋,它設定的是$_REQUEST變數的設定和覆蓋順序。如果為空白,也就是$_REQUEST不包含P(Post),G(Get)和C(Cookie)變數了,自然就是空了

那 php 的下面這句話是什麼意思:

If this directive is not set, variables_order is used for $_REQUEST contents.


不是說留空就會使用 variables_order 的值嗎?

還有 php.ini 裡面說的 :

 626 ; This directive determines which super global data (G,P,C,E & S) should 627 ; be registered into the super global array REQUEST. If so, it also determines 628 ; the order in which that data is registered. The values for this directive are 629 ; specified in the same manner as the variables_order directive, EXCEPT one. 630 ; Leaving this value empty will cause PHP to use the value set in the 631 ; variables_order directive. It does not mean it will leave the super globals 632 ; array REQUEST empty. 633 ; Default Value: None 634 ; Development Value: "GP" 635 ; Production Value: "GP" 636 ; http://php.net/request-order 637 request_order = "GP"


難道我理解錯了嗎?我的英文水平是比較差。。。




不知道你怎麼請求的,把你的請求流程說明一下。

xxx.php?aaa=bbb

request_order 為空白的時候 $_REQUEST 是空數組,
request_order = "GP" 的時候 $_REQUEST 才有內容。


這就對了,看request_order 的解釋,它設定的是$_REQUEST變數的設定和覆蓋順序。如果為空白,也就是$_REQUEST不包含P(Post),G(Get)和C(Cookie)變數了,自然就是空了

那 php 的下面這句話是什麼意思:

If this directive is not set, variables_order is used for $_REQUEST contents.


不是說留空就會使用 variables_order 的值嗎?

還有 php.ini 裡面說的 :

 626 ; This directive determines which super global data (G,P,C,E & S) should 627 ; be registered into the super global array REQUEST. If so, it also determines 628 ; the order in which that data is registered. The values for this directive are 629 ; specified in the same manner as the variables_order directive, EXCEPT one. 630 ; Leaving this value empty will cause PHP to use the value set in the 631 ; variables_order directive. It does not mean it will leave the super globals 632 ; array REQUEST empty. 633 ; Default Value: None 634 ; Development Value: "GP" 635 ; Production Value: "GP" 636 ; http://php.net/request-order 637 request_order = "GP"


難道我理解錯了嗎?我的英文水平是比較差。。。


剛測試了。variables_order = "GP"
或者variables_order = "GPCS"
request_order =
的情況下確實如手冊所說,request_order的值會使用variables_order的值。
php 5.2.17.

比較納悶的是,記得changelog中request_order是在5.3中引入的,不知為何5.2的配置中也有該配置項





不知道你怎麼請求的,把你的請求流程說明一下。

xxx.php?aaa=bbb

request_order 為空白的時候 $_REQUEST 是空數組,
request_order = "GP" 的時候 $_REQUEST 才有內容。


這就對了,看request_order 的解釋,它設定的是$_REQUEST變數的設定和覆蓋順序。如果為空白,也就是$_REQUEST不包含P(Post),G(Get)和C(Cookie)變數了,自然就是空了

那 php 的下面這句話是什麼意思:

If this directive is not set, variables_order is used for $_REQUEST contents.


不是說留空就會使用 variables_order 的值嗎?

還有 php.ini 裡面說的 :

 626 ; This directive determines which super global data (G,P,C,E & S) should 627 ; be registered into the super global array REQUEST. If so, it also determines 628 ; the order in which that data is registered. The values for this directive are 629 ; specified in the same manner as the variables_order directive, EXCEPT one. 630 ; Leaving this value empty will cause PHP to use the value set in the 631 ; variables_order directive. It does not mean it will leave the super globals 632 ; array REQUEST empty. 633 ; Default Value: None 634 ; Development Value: "GP" 635 ; Production Value: "GP" 636 ; http://php.net/request-order 637 request_order = "GP"


難道我理解錯了嗎?我的英文水平是比較差。。。


剛測試了。variables_order = "GP"
或者variables_order = "GPCS"
request_order =
的情況下確實如手冊所說,request_order的值會使用variables_order的值。
php 5.2.17.

比較納悶的是,記得changelog中request_order是在5.3中引入的,不知為何5.2的配置中也有該配置項

但是我用外國的伺服器 php 5.3.24 和本地的 php 5.4.4 測試的結果都是 request_order 留空並不會使用 variables_order 的值,而是直接把 $_REQUEST 留空了。

request_order 的確是 5.3 才引進的,會不會是你設定的 request_order 壓根沒起作用?5.3之前可能 $_REQUEST 直接就使用的 variables_order。

對於 $_REQUEST 的處理,php5.3 的早期版本是有問題的
至少在 php 5.3.6 中,如果沒有傳入資料,則 $_REQUEST 是未定義的,而不是僅僅為空白
不太清楚這個問題是在哪個版本中被糾正的


It does not mean it will leave the super globals array REQUEST empty.

對於 $_REQUEST 的處理,php5.3 的早期版本是有問題的
至少在 php 5.3.6 中,如果沒有傳入資料,則 $_REQUEST 是未定義的,而不是僅僅為空白
不太清楚這個問題是在哪個版本中被糾正的


It does not mean it will leave the super globals array REQUEST empty.

我測試的兩個版本是空數組,不是未定義,
剛剛看了 ChangeLog 也沒有提到這個,照這麼說php文檔和php.ini上面說的都是有錯誤的咯?

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.