Home  >  Article  >  Backend Development  >  php $_SERVER["REQUEST_URI"]获取值的通用解决方法_php技巧

php $_SERVER["REQUEST_URI"]获取值的通用解决方法_php技巧

WBOY
WBOYOriginal
2016-05-17 09:24:531118browse
复制代码 代码如下:

// 说明:获取 _SERVER['REQUEST_URI'] 值的通用解决方案
function request_uri()
{
if (isset($_SERVER['REQUEST_URI']))
{
$uri = $_SERVER['REQUEST_URI'];
}
else
{
if (isset($_SERVER['argv']))
{
$uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0];
}
else
{
$uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
}
}
return $uri;
}
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn