Thare are two ways to get current working foldr(directory) in php
1.getcwd() — Gets the current working directory.
In php you can easily get current script working folder using getcwd().
On some Unix variants, getcwd() will return FALSE if any one of the parent directories does not have the readable or search mode set, even if the current directory does.
ex- echo getcwd();
will return c:\apache\htdocs\phpproject\example
2. Using dirname()
example : echo dirname(__FILE__);
__FILE__ in PHP will retuen current executing script and dirname() strips scriptname and result will be current working directory
1.getcwd() — Gets the current working directory.
In php you can easily get current script working folder using getcwd().
On some Unix variants, getcwd() will return FALSE if any one of the parent directories does not have the readable or search mode set, even if the current directory does.
ex- echo getcwd();
will return c:\apache\htdocs\phpproject\example
2. Using dirname()
example : echo dirname(__FILE__);
__FILE__ in PHP will retuen current executing script and dirname() strips scriptname and result will be current working directory
No comments:
Post a Comment