PHP basename() 函数

 

取出目录路径中的文件名字

code

<?php
$path = "/testweb/home.php";

//Show filename with file extension
echo basename($path) ."<br/>";

//Show filename without file extension
echo basename($path,".php");
?>

输出

home.php
home

 

参考:

https://www.runoob.com/php/func-filesystem-basename.html

 

 

 

posted @ 2019-07-31 23:35  anobscureretreat  阅读(252)  评论(0编辑  收藏  举报