PHP Get Absolute Path

The PHP Get Absolute Path example shows you how you can get the absolute path of any file.

 
 

Share on Google+Share on Google+

PHP Get Absolute Path

Ads

The PHP Get Absolute Path example shows you how you can get the absolute path of any file.

This example shows you how you can get the absolute path of a file. We will use the dirname() function and then with the help of realpath() function we can get the absolute path of the file.

Code:

<?php//to know your absolute path

echo realpath(dirname("absolutepath.php"));

?>

Output:

/phpexample/absolutepath.php

Advertisements

Posted on: October 9, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles