Php file path operation $ url = 'http ://'. $ _ SERVER ['http _ host']. substr ($ REQUEST_URI, 0, strrpos ($ REQUEST_URI, '/'); echo $ url; echo "& lt; p & gt ;"; // echostrrpos ($ R php file path operation)
$ 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']."
";?? // Obtain the server document root
Echo $ _ SERVER ['php _ SELF ']."
"; // Obtain the absolute path of the file server that executes the code
Echo _ FILE __."
"; // Obtain the absolute path of the file system
Echo dirname (_ FILE _); // Obtain the path of the folder where the FILE is located.
Result
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
?