搜尋
首頁後端開發php教程$_REQUEST为什么是空的?

我的 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上面说的都是有错误的咯?

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
PHP如何識別用戶的會話?PHP如何識別用戶的會話?May 01, 2025 am 12:23 AM

phpIdentifiesauser'ssessionSessionSessionCookiesAndSessionId.1)whiwsession_start()被稱為,phpgeneratesainiquesesesessionIdStoredInacookInAcookInAcienamedInAcienamedphpsessIdontheuser'sbrowser'sbrowser.2)thisIdallowSphptpptpptpptpptpptpptpptoretoreteretrieetrieetrieetrieetrieetrieetreetrieetrieetrieetrieetremthafromtheserver。

確保PHP會議的一些最佳實踐是什麼?確保PHP會議的一些最佳實踐是什麼?May 01, 2025 am 12:22 AM

PHP會話的安全可以通過以下措施實現:1.使用session_regenerate_id()在用戶登錄或重要操作時重新生成會話ID。 2.通過HTTPS協議加密傳輸會話ID。 3.使用session_save_path()指定安全目錄存儲會話數據,並正確設置權限。

PHP會話文件默認存儲在哪裡?PHP會話文件默認存儲在哪裡?May 01, 2025 am 12:15 AM

phpsessionFilesArestoredIntheDirectorySpecifiedBysession.save_path,通常是/tmponunix-likesystemsorc:\ windows \ windows \ temponwindows.tocustomizethis:tocustomizEthis:1)useession_save_save_save_path_path()

您如何從PHP會話中檢索數據?您如何從PHP會話中檢索數據?May 01, 2025 am 12:11 AM

ToretrievedatafromaPHPsession,startthesessionwithsession_start()andaccessvariablesinthe$_SESSIONarray.Forexample:1)Startthesession:session_start().2)Retrievedata:$username=$_SESSION['username'];echo"Welcome,".$username;.Sessionsareserver-si

您如何使用會議來實施購物車?您如何使用會議來實施購物車?May 01, 2025 am 12:10 AM

利用會話構建高效購物車系統的步驟包括:1)理解會話的定義與作用,會話是服務器端的存儲機制,用於跨請求維護用戶狀態;2)實現基本的會話管理,如添加商品到購物車;3)擴展到高級用法,支持商品數量管理和刪除;4)優化性能和安全性,通過持久化會話數據和使用安全的會話標識符。

您如何在PHP中創建和使用接口?您如何在PHP中創建和使用接口?Apr 30, 2025 pm 03:40 PM

本文解釋瞭如何創建,實施和使用PHP中的接口,重點關注其對代碼組織和可維護性的好處。

crypt()和password_hash()有什麼區別?crypt()和password_hash()有什麼區別?Apr 30, 2025 pm 03:39 PM

本文討論了PHP中的crypt()和password_hash()的差異,以進行密碼哈希,重點介紹其實施,安全性和對現代Web應用程序的適用性。

如何防止PHP中的跨站點腳本(XSS)?如何防止PHP中的跨站點腳本(XSS)?Apr 30, 2025 pm 03:38 PM

文章討論了通過輸入驗證,輸出編碼以及使用OWASP ESAPI和HTML淨化器之類的工具來防止PHP中的跨站點腳本(XSS)。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

MantisBT

MantisBT

Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

mPDF

mPDF

mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

WebStorm Mac版

WebStorm Mac版

好用的JavaScript開發工具

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器