Here is my string
$newPath = '/~new/assets/js/../packages/prettyphoto/js/jquery.prettyPhoto.js';
Now check this output
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() returns FALSE on failure, eg if the file does not exist.
You can find out by adding
print_r(error_get_last());
After your statement. The possible errors are described in the man page .
A quick look on the php.net definition of realpath shows this note, which may be pertinent:
Note: The running script must have executable permissions on all directories in the hierarchy, otherwise realpath() will return FALSE .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.