Operation of PHP file path
$url = ' http://' $_server[' Http_host '].substr ($REQUEST _uri,0,strrpos ($REQUEST _uri, '/'));
echo $url;
echo "
";
Echo Strrpos ($REQUEST _uri, '/');
Echo substr ($REQUEST _uri,0,strrpos ($REQUEST _uri, '/'));
echo dirname ($_server[' script_filename ');
echo "
";
echo $_server[' php_self '];
echo "
";
echo $_server[' Script_name '];
echo "
";
echo $db =$_server[' Document_root ']. ' /access/db.mdb ';
echo "
";
echo Realpath ("");
echo "
";
echo $_server[' Document_root '];
echo "
";
echo "
";
echo $_server[' Document_root ']. "
";?? Get the server document root
echo $_server[' php_self ']. "
"; Get the absolute path to the file server executing the code
echo __file__. "
"; Get file system absolute path to files
echo dirname (__file__); Get the folder path where the file is located
Results
Http://localhost/test
F:/kuikoo/test
/test/url.php
/test/url.php
F:/kuikoo/access/db.mdb
F:\kuikoo\test
F:/kuikoo
?
F:/kuikoo
/test/url.php
F:\kuikoo\test\url.php
F:\kuikoo\test
?