PHP realpath() 函数

定义和用法

realpath() 函数返回绝对路径。

该函数删除所有符号连接(比如 '/./', '/../' 以及多余的 '/'),返回绝对路径名。

若失败,则返回 false。比如说文件不存在的话。

例如:

<?php
    echo realpath("test.txt");
?>

输出:

C:Inetpub	estweb	est.txt

又如:

<?php
$str = "d:My Documents1";
echo realpath($str);
?>

输出:

D:My Documents1
 也就是说,物理路径后面是不带 “” 或 “/” 的!
原文地址:https://www.cnblogs.com/52php/p/5666495.html