定义和用法
realpath() 函数返回绝对路径。
该函数删除所有符号连接(比如 '/./', '/../' 以及多余的 '/'),返回绝对路径名。
若失败,则返回 false。比如说文件不存在的话。
例如:
<?php
echo realpath("test.txt");
?>
输出:
C:\Inetpub\testweb\test.txt
又如:
<?php
$str = "d:\My Documents\1\";
echo realpath($str);
?>
输出:
D:\My Documents\1
也就是说,物理路径后面是不带 “” 或 “/” 的!