欧美日韩精品在线,国内精品久久久久久久久,一级毛片恃级毛片直播,清纯唯美亚洲综合欧美色

php中使用$_REQUEST需要注意的一個(gè)問(wèn)題_PHP教程

編輯Tag賺U幣
教程Tag:phpRequest添加

推薦:基于MySQL分區(qū)性能的詳細(xì)介紹
本篇文章介紹了,對(duì)MySQL分區(qū)性能的詳細(xì)說(shuō)明,需要的朋友參考下

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

$_REQUEST

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

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

 

答案
其實(shí)changelog中有給出解釋:

版本5.3以上,php.ini中有request_order屬性來(lái)設(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.

 

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

 

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

提醒下如果你是使用fpm-php實(shí)驗(yàn)的話,改了php.ini后你需要重啟php-fpm

分享:記錄mysql性能查詢過(guò)程的使用方法
本篇文章介紹了,記錄mysql性能查詢過(guò)程的使用方法。需要的朋友參考下

來(lái)源:模板無(wú)憂//所屬分類:PHP教程/更新時(shí)間:2013-05-03
相關(guān)PHP教程