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

WBOY
Release: 2016-06-13 13:39:19
Original
939 people have browsed it

如何截取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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!