php $_SERVER["REQUEST_URI"]获取值的通用解决方法
(编辑:jimmy 日期: 2024/11/17 浏览:3 次 )
复制代码 代码如下:
<?php
// 说明:获取 _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;
}
?>
<?php
// 说明:获取 _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;
}
?>
下一篇:php自动加载的两种实现方法