发布日期:2018-03-26
如何通过PHP中的完整路径获得文件名?+ 查看更多
如何通过PHP中的完整路径获得文件名?
+ 查看更多
发布日期:2018-03-26 14:05
分类:PHP
浏览次数:58
如下:
例如: 在PHP中如何从
例如: 在PHP中如何从
F:\Program Files\SSH Communications Security\SSH Secure Shell\Output.map
得到Output.map
回答:
你正在寻找的是去掉路径后的文件名.
PHP手册中的例子是这样的:
PHP手册中的例子是这样的:
<?php $path = "/home/httpd/html/index.php"; $file = basename($path); // $file is set to "index.php" $file = basename($path, ".php"); // $file is set to "index" ?>