PHP:将虚拟路径转换为物理路径
在PHP中是否可以将服务器相对虚拟路径转换为物理路径 e、 g.如果我有一个url:PHP:将虚拟路径转换为物理路径,php,Php,在PHP中是否可以将服务器相对虚拟路径转换为物理路径 e、 g.如果我有一个url: /home/index.php 然后以某种方式从其他脚本中找到index.php的物理路径?Prepend$\u SERVER[“DOCUMENT\u ROOT”]到您要查找的脚本路径。 谢谢benoit,这正是我想要的。 $path = 'mydir/index.php'; echo realpath($path);
/home/index.php
然后以某种方式从其他脚本中找到index.php的物理路径?Prepend$\u SERVER[“DOCUMENT\u ROOT”]
到您要查找的脚本路径。
谢谢benoit,这正是我想要的。
$path = 'mydir/index.php';
echo realpath($path);