如何使用PHP从完整路径获取文件名? [英] How do I get a file name from a full path with PHP?

查看:68
本文介绍了如何使用PHP从完整路径获取文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,如何获取Output.map

来自

F:\Program Files\SSH Communications Security\SSH Secure Shell\Output.map

使用PHP?

推荐答案

您正在寻找

You're looking for basename.

PHP手册中的示例:

The example from the PHP manual:

<?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"
?>

这篇关于如何使用PHP从完整路径获取文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆