最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php中使用$_REQUEST需要注意的一個問題

 更新時間:2013年05月02日 09:22:51   作者:  
本篇文章介紹了,php中使用$_REQUEST需要注意的一個問題,需要的朋友參考下

問題
說起$_REQUEST,大家都知道的是它是$_GET和$_POST的集合。但是如果你有心的話,查一下文檔,會看到:

$_REQUEST

An associative array that by default contains the contents of $_GET, $_POST and $_COOKIE.

這里說$_REQUEST默認是$_GET, $_POST, $_COOKIE的集合,結(jié)果我使用我本地的php查看了一下發(fā)現(xiàn)只有$_GET, $_POST, 沒有$_COOKIE??! 難道文檔是錯的?

 

答案
其實changelog中有給出解釋:

版本5.3以上,php.ini中有request_order屬性來設(shè)置$_REQUEST。查了下php.ini, request_order設(shè)置成為了GP(Get and Post)。

 

request_order的官網(wǎng)描述:

request_order string

This directive describes the order in which PHP registers GET, POST and Cookie variables into the _REQUEST array. Registration is done from left to right, newer values override older values.

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

Note that the default distribution php.ini files does not contain the 'C' for cookies, due to security concerns.

 

原來是G,P,C分別代表Get,Post,Cookie,5.3以上的版本request_order默認是設(shè)置成GP的,并不包含C,即$_REQUEST默認只包含$_GET和$_POST !! (所以官網(wǎng)文檔有一定的誤導)。

 

也同時說一下G,P,C的先后順序就是設(shè)置的array的覆蓋順序。

提醒下如果你是使用fpm-php實驗的話,改了php.ini后你需要重啟php-fpm

相關(guān)文章

最新評論

方城县| 泉州市| 天门市| 遂昌县| 聊城市| 兴隆县| 沁阳市| 临安市| 平乡县| 琼中| 高碑店市| 浠水县| 德格县| 呼伦贝尔市| 汉沽区| 金寨县| 阳东县| 益阳市| 诸暨市| 镇原县| 青河县| 兴城市| 临泉县| 修武县| 隆安县| 普兰县| 海南省| 延津县| 即墨市| 新兴县| 翁牛特旗| 南雄市| 渝北区| 周宁县| 理塘县| 嫩江县| 宣城市| 县级市| 镶黄旗| 冕宁县| 曲靖市|