how to get full folder path php

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

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

No comments:

Post a Comment