获取 Zend Framework 中 htdocs 文件夹的本地路径
Getting local path to of the htdocs folder in Zend Framework
我想知道是否有办法使用 Zend 框架在 PHP 中获取本地路径。该应用程序位于 mamp 的 htdocs 文件夹中,如下所示:
E:\MAMP\htdocs\frontend\public
我想要这条路径,或者至少是 Zend 中的一部分?
可能是
Application_Path/frontend/public/site/destinationFolder
有人可以帮我解决这个问题吗:)?
非常感谢!!
您可以 use the php function getcwd();
为此(returns 当前工作目录):
$rootPath = getcwd();
所以 public 文件夹将是:
$publicPath = getcwd() . DIRECTORY_SEPARATOR . 'public';
这是有效的,因为 on line 6 of the index.php
file of your ZF2 application 工作目录设置为此目录:
chdir(dirname(__DIR__));
我想知道是否有办法使用 Zend 框架在 PHP 中获取本地路径。该应用程序位于 mamp 的 htdocs 文件夹中,如下所示:
E:\MAMP\htdocs\frontend\public
我想要这条路径,或者至少是 Zend 中的一部分?
可能是
Application_Path/frontend/public/site/destinationFolder
有人可以帮我解决这个问题吗:)?
非常感谢!!
您可以 use the php function getcwd();
为此(returns 当前工作目录):
$rootPath = getcwd();
所以 public 文件夹将是:
$publicPath = getcwd() . DIRECTORY_SEPARATOR . 'public';
这是有效的,因为 on line 6 of the index.php
file of your ZF2 application 工作目录设置为此目录:
chdir(dirname(__DIR__));