file_exists() returns false, but the file DOES exist

后端 未结 14 1277
一向
一向 2020-12-05 09:40

I\'m having a very weird issue with file_exists(). I\'m using this function to check if 2 different files in the same folders do exist. I\'ve double-checked, they BOTH do ex

14条回答
  •  误落风尘
    2020-12-05 10:13

    I spent the last two hours wondering what was wrong with my if statement: file_exists($file) was returning false, however I could call include($file) with no problem.

    It turns out that I didn't realize that the php include_path value I had set in the .htaccess file didn't carry over to file_exists, is_file, etc.

    Thus:

    
    

    Just goes to show that "shortcuts for simplicity" like setting the include_path in .htaccess can just cause more grief in the long run.

提交回复
热议问题