Home >Backend Development >PHP Tutorial >怎么截取url上面最后的地址

怎么截取url上面最后的地址

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 10:13:421067browse

如何截取url上面最后的地址?
http://forum.csdn.net/PointForum/Forum/test.aspx

比如这个url上面最后的test.aspx。

除了用substr()还有什么方法吗?

php应该有这样的函数把?

一般都是怎么做的?

------解决方案--------------------

PHP code
<?php $path="http://forum.csdn.net/PointForum/Forum/test.aspx";//basename函数,返回文件名部分echo basename($path).PHP_EOL;//pathinfo(),返回文件路径的相关信息echo pathinfo($path,PATHINFO_BASENAME);?><div class="clear">
                 
              
              
        
            </div>
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