Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个文件路径-
Doc/Monday/File.txt
我想使用 substr() 来选择File.txtPHP。我怎么做?
File.txt
basename('/some/path/to/file.txt');
用“/”分解字符串,取出结果数组的最后一个元素
TRy this
$data= pathinfo('/some/path/to/file.txt'); echo $data['basename'];