PHP:$ _ SERVER ['REDIRECT_URL']与$ _SERVER ['REQUEST_URI'] [英] PHP: $_SERVER['REDIRECT_URL'] vs $_SERVER['REQUEST_URI']

查看:500
本文介绍了PHP:$ _ SERVER ['REDIRECT_URL']与$ _SERVER ['REQUEST_URI']的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打印了$ _SERVER,发现$ _SERVER['REDIRECT_URL']$_SERVER['REQUEST_URI']都具有相同的值.两者有什么区别?

I printed $_SERVER, and I found out that $_SERVER['REDIRECT_URL'] vs $_SERVER['REQUEST_URI'] both have same values. What's the difference between the two?

推荐答案

REQUEST_URI 是在HTTP请求行.内部重定向发生时, REDIRECT_URL 由Apache 创建:

REQUEST_URI is the requested URI path and query as used in the HTTP request line. REDIRECT_URL is created by Apache when an internal redirect happens:

REDIRECT_环境变量是根据重定向之前存在的环境变量创建的.它们使用REDIRECT_前缀重命名,即HTTP_USER_AGENT变为REDIRECT_HTTP_USER_AGENT.

REDIRECT_ environment variables are created from the environment variables which existed prior to the redirect. They are renamed with a REDIRECT_ prefix, i.e., HTTP_USER_AGENT becomes REDIRECT_HTTP_USER_AGENT.

REDIRECT_URLREDIRECT_STATUSREDIRECT_QUERY_STRING,并且只有在错误条件之前存在其他标头时,才会设置其他标头.

REDIRECT_URL, REDIRECT_STATUS, and REDIRECT_QUERY_STRING are guaranteed to be set, and the other headers will be set only if they existed prior to the error condition.

请注意, REDIRECT_URL 仅包含URI路径.

Note that REDIRECT_URL does only contain the URI path.

这篇关于PHP:$ _ SERVER ['REDIRECT_URL']与$ _SERVER ['REQUEST_URI']的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆