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.
我正在使用以下 PHP 代码片段来显示目录中的所有 pdf。如何更改此代码以仍指定目录但仅显示文件名?
foreach (glob("directory/sub-directory/sub-subdirectory/*.pdf") as $filename) { echo "$filename <BR>\n"; }
这个怎么样:
$shortname = basename($filename); echo "$shortname <BR />\n";
您将使用basename函数。