filemtime “warning stat failed for”

前端 未结 4 723
挽巷
挽巷 2021-01-01 10:07

I already read it so many questions and answers about it but I can\'t still solve my problem...

I\'m trying to create a function that deletes all the files with \"xm

4条回答
  •  感情败类
    2021-01-01 10:54

    For me the filename involved was appended with a querystring, which this function didn't like.

    $path = 'path/to/my/file.js?v=2'
    

    Solution was to chop that off first:

    $path = preg_replace('/\?v=[\d]+$/', '', $path);
    $fileTime = filemtime($path);
    

提交回复
热议问题