file_exists() is too slow in PHP. Can anyone suggest a faster alternative?

后端 未结 19 1062
迷失自我
迷失自我 2021-02-05 01:18

When displaying images on our website, we check if the file exists with a call to file_exists(). We fall back to a dummy image if the file was missing.

Howe

19条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-05 01:56

    I came to this page looking for a solution, and it seems fopen may do the trick. If you use this code, you might want to disable error logging for the files that are not found.

    
    

提交回复
热议问题