PHP basename() Function: Get File or Directory Name
The 'basename()' function in PHP is used to get the base name of a file or directory from a given path. It returns the trailing name component of the path, which is the file or directory name without the path information.
Here is an example usage of the 'basename()' function:
$path = '/path/to/file.txt';
$filename = basename($path);
echo $filename; // Output: file.txt
In this example, the 'basename()' function returns the file name 'file.txt' from the given path '/path/to/file.txt'.
原文地址: https://www.cveoy.top/t/topic/p8xO 著作权归作者所有。请勿转载和采集!