我有一个很长的文件路径,例如
http://www.mysite.com/local/views/templates/home.php
并且我使用basename()
仅返回文件本身,
<?php echo basename($file);?>
但是,如果没有文件的基本名称(如下面的行),我如何返回文件的路径?
http://www.mysite.com/local/views/templates/
您正在查找dirname
(尽管它没有留下斜杠)。
在实际操作中查看。
我有一个很长的文件路径,例如
http://www.mysite.com/local/views/templates/home.php
并且我使用basename()
仅返回文件本身,
<?php echo basename($file);?>
但是,如果没有文件的基本名称(如下面的行),我如何返回文件的路径?
http://www.mysite.com/local/views/templates/
您正在查找dirname
(尽管它没有留下斜杠)。
在实际操作中查看。