PHP basename () function

 

Remove the directory path of the file name

code

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

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

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

Export

home.php
home

 

reference:

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

 

 

 

Guess you like

Origin www.cnblogs.com/sea-stream/p/11279888.html