Today, We want to share with you How to Get Absolute Directory Path in PHP Script.In this post we will show you php get directory of current file, hear for How to get absolute path on a web server using PHP we will give you demo and example for implement.In this post, we will learn about How to get the absolute path to the public_html folder with an example.
How to Get Absolute Directory Path in PHP Script
There are the Following The simple About How to Get Absolute Directory Path in PHP Script Full Information With Example and source code.
As I will cover this Post with live Working example to develop how to get selected file path in php, so the php get root directory of website for this example is following below.
using new constant called __DIR__
absolute directory path in PHP
echo realpath(dirname(__FILE__)); //other way echo getcwd(); //new print_r($_SERVER['DOCUMENT_ROOT']); // absolute path with file name echo $_SERVER['SCRIPT_FILENAME'];
I hope you get an idea about How to Get Absolute Directory Path in PHP Script.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.