检查路径是否有效。
此函数会返回一个没有符号连接的服务器路径或相对目录结构,函数中的第二个参数为TRUE时,如果程序无法确定指定的路径,则会触发一个错误。[code]$directory = ‘/etc/passwd’;
echo set_realpath($directory);
// returns “/etc/passwd”
$non_existent_directory = ‘/path/to/nowhere’;
echo set_realpath($non_existent_directory, TRUE);
// returns an error, as the path could not be resolved
echo set_realpath($non_existent_directory, FALSE);
// returns “/path/to/nowhere”[/code]文章来源:[url]http://cwiki.ossez.com/pages/viewpage.action?pageId=2392219[/url]