开发者

How to check if a file was modified/newer than another file using PHP?

开发者 https://www.devze.com 2023-02-28 16:30 出处:网络
Say I\'ve got two dirs, foo and bar. Both have got a file \'test.php\'. I\'d like to c开发者_StackOverflow社区heck if the copy of test.php in bar is newer than the one in foo. How can I do this? I\'m

Say I've got two dirs, foo and bar. Both have got a file 'test.php'. I'd like to c开发者_StackOverflow社区heck if the copy of test.php in bar is newer than the one in foo. How can I do this? I'm using windows XP but would prefer a cross platform solution, though if that's possible, windows only would work too.

Edit: Only need to check text files containing code, e.g: php, javascript, css, and html files. No need to check for images though if that could be checked it'd be a bonus.


Use: filemtime($filename)


filemtime should work for you.


You could try to use filemtime which should tell the last modified timestamp


Use filemtime

0

精彩评论

暂无评论...
验证码 换一张
取 消