I was wondering if there is a way to get the local path in PHP using Zend framework. The application is located in the mamp's htdocs folder like this:
E:\MAMP\htdocs\frontend\public
I'd like to get this path, or at least the part of it in Zend?
Maybe something like
Application_Path/frontend/public/site/destinationFolder
Can someone help me out with this please :) ?
Thanks heaps!!
You can use the php function getcwd();
for this (it returns the current working directory):
$rootPath = getcwd();
So public folder would be:
$publicPath = getcwd() . DIRECTORY_SEPARATOR . 'public';
This works because on line 6 of the index.php
file of your ZF2 application the working directory is set to this directory:
chdir(dirname(__DIR__));