php 获取当前访问的url文件名的方法小结
方法一:<?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;
echo $filename;
?>
方法四:
<?php
$url = $_SERVER['PHP_SELF'];
$filename = end(explode('/',$url));
echo $filename;
?>
出处:http://www.jb51.net/article/22056.htm
页:
[1]