简体   繁体   中英

Function file_exists always return false

I always get false when calling a function file_exists. I can get the full path of a file using readlink -f test.txt . And then when I do file_exists('/home/user/projects/test_project/test.txt') , I'm getting false. Why?

I was thinking maybe something with the file permissions. But the chmod or chown didn't help me. Moving the file to the folder file_exists('/home/user/test.txt') didn't help me too.

PHP8.0

file_exists uses the rights of the running process, so the process must have access to the folder. i believe this is a system restriction, and not a php issue. can you use file_exists on the script running? like an file_exists("./index.php");

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM