How to delete files from directory based on creation date in php?

前端 未结 8 1857
囚心锁ツ
囚心锁ツ 2020-11-29 03:52

I have a cache folder that stores html files. They are overwritten when needed, but a lot of the time, rarely used pages are cached in there also, that just end up using sp

8条回答
  •  孤街浪徒
    2020-11-29 04:35

    It should be

    if((time()-$filelastmodified) > 24*3600 && is_file($file))
    

    to avoid errors for the . and .. directories.

提交回复
热议问题