我想:
$path = dirname('http://www.domain.com/folder1/folder2/folder3/folder4');
echo $path;
要返回:
的folder1 /文件夹2 / folder3 / folder4
我希望它能与URL的所有可能替代方案一起使用,例如:
http://www.domain.com/folder1/folder2/folder3/folder4
http://www.domain.com/folder1/folder2/folder3/folder4/
http://folder1.domain.com/folder2/folder3/folder4/index.html
http://www.domain.com/folder1/folder2/folder3/folder4/index.html
http://domain.com/folder1/folder2/folder3/folder4/index.html
我如何在PHP中执行此操作
答案 0 :(得分:2)