PHP 中获取文件名及路径

[an error occurred while processing the directive]

basename(“/mnt/img/image01.jpg”)函数:得到文件名;输出结果为:image01.jpg.使用 basename($uriString) 我们可以得到一个包含扩展名的文件名;

如果不需要扩展名,也可以使用 basename(uriString, extString) 过滤扩展名,仅仅返回文件名。

echo __FILE__;得到当前请求文件的完整路径,输出格式如:/mnt/hgfs/ictsapce/test/index.php3.dirname() 函数返回路径中的目录部分。如:

echo dirname(“/testweb/home.php”);

输出:/testweb

未经允许不得转载:肥猫博客 » PHP 中获取文件名及路径

[an error occurred while processing the directive]
Copyright © 2088 米策网游动态中心-新游测试与公会争霸 All Rights Reserved.
友情链接