PHP basename() 函数

PHP 教程 · 2019-01-24 16:59:46

定义和用法

basename() 函数返回路径中的文件名部分。

语法


basename(path,suffix)


参数 描述
path 必需。规定要检查的路径。
suffix 可选。规定文件扩展名。如果文件有名有文件扩展名,将不会显示这个扩展名。

实例


<?php
$path = "/testweb/home.php";
//Show filename with file extension
echo basename($path) ."<br/>";
//Show filename without file extension
echo basename($path,".php");
?> 

上面的代码将输出:


home.php
home


点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html

查看所有标签

Rationality for Mortals

Rationality for Mortals

Gerd Gigerenzer / Oxford University Press, USA / 2008-05-02 / USD 65.00

Gerd Gigerenzer's influential work examines the rationality of individuals not from the perspective of logic or probability, but from the point of view of adaptation to the real world of human behavio......一起来看看 《Rationality for Mortals》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具