php realpath

定义和用法:

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

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

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

示例:

$img_url = 'app/business/controller/../../public/1.img';

$real_url = realpath($img_url);

echo $real_url;  //  输出 app/public/1.img

原文地址:https://www.cnblogs.com/gyrgyr/p/13140628.html