问题描述
标题中的问题.
$_GET[foo]
,$_POST[foo]
和$_COOKIE[foo] exist?
中的所有三个都包含在$_REQUEST?
And what happens when all 3 of $_GET[foo]
, $_POST[foo]
and $_COOKIE[foo] exist?
Which one of them gets included to $_REQUEST?
推荐答案
我不会说.
如果我希望通过各种方法进行设置,我会为每个方法编写代码,以提醒自己我已经这样做了-否则,您可能最终会被覆盖而无法意识到.
If I wanted something to be set via the various methods, I'd code for each of them to remind myself that I'd done it that way - otherwise you might end up with things being overwritten without realising.
它不应该这样工作吗:
$ _ GET =非破坏性操作(排序,记录操作,查询)
$_GET = non destructive actions (sorting, recording actions, queries)
$ _ POST =破坏性操作(删除,更新)
$_POST = destructive actions (deleting, updating)
$ _ COOKIE =琐碎的设置(样式表首选项等)
$_COOKIE = trivial settings (stylesheet preferences etc)
$ _ SESSION =非琐碎的设置(用户名,已登录?,访问级别)
$_SESSION = non trivial settings (username, logged in?, access levels)
这篇关于什么时候以及为什么应该使用$ _REQUEST代替$ _GET/$ _POST/$ _COOKIE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!