How to get error result of unlink

后端 未结 3 1296
北海茫月
北海茫月 2021-02-07 10:41

If a call to unlink() returns false for the specified path, how do you find out what the reason for the failure was (i.e. EISDIR, ENOENT, ELOOP etc.)? PHP 5.x running on redhat

3条回答
  •  日久生厌
    2021-02-07 11:18

    here's one way

    unlink("/path/that/does/not/exist");
    print_r(error_get_last());
    

    See Error handling for more details

提交回复
热议问题