开发者

PHP: translate virtual path to physical path

开发者 https://www.devze.com 2022-12-20 00:24 出处:网络
Is it possible to translate a server relative vir开发者_JAVA百科tual path to physical path in PHP?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号