php获取当前访问的文件名
时间:2010-04-22 来源:admin126com
方法一:
<?php
$url=$HTTP_SERVER_VARS['REQUEST_URI'];
echo(str_replace('/','',$url));
?>
方法二:
<?php
- $url = $_SERVER['PHP_SELF'];
- $filename= substr( $url , strrpos($url , ‘/’)+1 );
- echo $filename;
?>
方法三:
<?php
- $url = $_SERVER['PHP_SELF'];
- $arr = explode( '/' , $url );
- $filename= $arr[count($arr)-1];
- echo $filename;
?>
方法四:
<?php
- $url = $_SERVER['PHP_SELF'];
- $filename = end(explode('/',$url));
- echo $filename;
?>
相关阅读 更多 +