basename() 函数返回路径中的文件名部分
定义和用法basename() 函数返回路径中的文件名部分。语法basename(path,suffix)参数描述
path必需。规定要检查的路径。
suffix可选。规定文件扩展名。如果文件有名有文件扩展名,将不会显示这个扩展名。
代码运行案例:
<?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
页:
[1]