Are rename() and unlink() asynchronous functions?

后端 未结 4 829
萌比男神i
萌比男神i 2021-01-22 09:37

I have strong reason to believe that both functions rename() and unlink() are asynchronous, which, from my understanding, means that when the functions are called, the code belo

4条回答
  •  半阙折子戏
    2021-01-22 10:02

    Mind that file-systems often use caches to reduce the load. Normally you won't notice, but sometimes you need to clear the cache if you need to have the real information. Check the configuration of your file-system if your issue is file-system related.

    PHP itself uses a cache as well for some file-operations, so clear that, too.

    See clearstatcache to clear the PHP stat cache.

    Take note that this is a "view" issue, the file is actually deleted on disk, but PHP might still return it's there (until you clear the cache).

提交回复
热议问题