为什么在realpath()中,此字符串在PHP中将返回false?

问题描述:

这是我的琴弦

$newPath = '/~new/assets/js/../packages/prettyphoto/js/jquery.prettyPhoto.js';

现在检查此输出

var_dump($newPath); // string(64) "/~new/assets/js/../packages/prettyphoto/js/jquery.prettyPhoto.js"
var_dump(realpath($newPath)); // bool(false)

有人知道为什么这对我会返回假吗?

Does anyone know why this would be returning false on me?

嘿,是提供 手动链接 在您的

Hey, you were the guy who provided the manual link in your last question! Don't just link it, read it. :)

realpath()在失败时返回FALSE,例如如果文件不存在.

realpath() returns FALSE on failure, e.g. if the file does not exist.