站长资源网络编程
php 获取当前访问的url文件名的方法小结
简介推荐函数:一是PHP获取当前页面的网址: dedecms也是用的这个//获得当前的脚本网址 function GetCurUrl() {if(!empty($_SERVER["REQUEST_URI"])) else
{
$scriptName = $_SERVER["PHP_SELF"];
if(empty($_SERVER["QUERY_STRING"]))
{
$nowurl = $scriptName;
} else
{
$nowurl = $scriptName."".$_SERVER["QUERY_STRING"];
}
}
return $nowurl;
}
方法一:
<"htmlcode"><"htmlcode"><"htmlcode"><?php $url = $_SERVER['PHP_SELF']; $filename = end(explode('/',$url)); echo $filename; ?>