How to check if a file has changed?

后端 未结 5 695
梦毁少年i
梦毁少年i 2020-12-20 02:53

I have an xml file with database information that should be loaded when the script is installed or when the content of the file changes. Can I use md5_file() on the xml file

5条回答
  •  情深已故
    2020-12-20 03:23

    Your best bet would be to store the file mod time and compare it to a file mod time you check in the future.

    if(filemtime('myfile.txt') > $result_set['filemtime']) {
        // file was modified
    }
    

    I have hope that you can do the databasing yourself.

提交回复
热议问题