PHP: How to check if file not exists or permission is denied?

前端 未结 5 2342
礼貌的吻别
礼貌的吻别 2020-12-21 09:05

I want to check if file do not exists. When file_exists() function returns false I can\'t be sure if the file do not exist or I don\'t have permiss

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-21 09:39

    Well, you could first try file_exists(). In the event that fails, you could try fopen() with the +a flag. If that fails, you don't have permission.

提交回复
热议问题