请求(Request)
sfWebRequest
类包含了$_SERVER
, $_COOKIE
, $_GET
, $_POST
, $_FILES
PHP全局数组:
getMethod() |
$_SERVER['REQUEST_METHOD'] |
getUri() |
$_SERVER['REQUEST_URI'] |
getReferer() |
$_SERVER['HTTP_REFERER'] |
getHost() |
$_SERVER['HTTP_HOST'] |
getLanguages() |
$_SERVER['HTTP_ACCEPT_LANGUAGE'] |
getCharsets() |
$_SERVER['HTTP_ACCEPT_CHARSET'] |
isXmlHttpRequest() |
$_SERVER['X_REQUESTED_WITH'] == 'XMLHttpRequest' |
getHttpHeader() |
$_SERVER |
getCookie() |
$_COOKIE |
isSecure() |
$_SERVER['HTTPS'] |
getFiles() |
$_FILES |
getGetParameter() |
$_GET |
getPostParameter() |
$_POST |
getUrlParameter() |
$_SERVER['PATH_INFO'] |
getRemoteAddress() |
$_SERVER['REMOTE_ADDR'] |
我们已经用过getParameter()
方法访问请求的参数,它返回$_GET
或$_POST
全局变量的值或~PATH_INFO~
变量。
如果你想确定请求参数究竟属于上面哪一类,你需要使用getGetParameter()
, getPostParameter()
, 和getUrlParameter()
。