Home > php教程 > php手册 > body text

php basename 函数

WBOY
Release: 2016-06-13 11:17:11
Original
1135 people have browsed it

下面来看看提供一关于件路径的组成部分basename函数实例教程  

下面来看看提供一关于件路径的组成部分basename函数实例教程

basename
( PHP 4中, PHP 5中)

basename -返回文件路径的组成部分

描述
字符串basename (字符串$路径[ ,字符串$后缀] )
鉴于一个字符串包含路径的文件,该函数将返回基地的档案名称。

参数

路径
一个路径。

在Windows中,这两个斜线( / )和反斜杠( )作为目录分隔符。在其他环境中,它是正斜杠( / ) 。

后缀
如果后缀结尾的文件名也将被切断。


返回值
返回基地名称指定路径。

修改

版本说明
4.1.0的后缀参数增加


实例

例如# 1 basename ( )例子

$path = "/home/httpd/html/index.php";
$file = basename($path);         // $file is set to "index.php"
$file = basename($path, ".php"); // $file is set to "index"
?>


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!