Is it possible to translate a server relative vir开发者_JAVA百科tual path to physical path in PHP?
e.g. if I have a url:
/home/index.php
then find the physical path of index.php somehow from some other script?
You're looking for realpath
$path = 'mydir/index.php';
echo realpath($path);
Prepend $_SERVER["DOCUMENT_ROOT"]
to the script path.
精彩评论