1. on stackoverflow, someone said that using md5 to implement the link stackoverflow. comques .... Please let me know how to achieve this. 3Q2, is there any other way to achieve monitoring? 1. on stack overflow, someone says that the link to md5 is http://stackoverflow.com/ques .... Please let me know how to implement it, 3Q
2. is there any other way to achieve monitoring?
Reply content:
1. on stack overflow, someone says that the link to md5 is http://stackoverflow.com/ques .... Please let me know how to implement it, 3Q
2. is there any other way to achieve monitoring?
1. Passscandir()Obtain all the files in this directory;
2.foreachTo traverse a file, usemd5file()Save the file's md5 value to a file in another directory OR database (why is it not an array OR another variable? Because the variables are cleared every time they are executed );
3. run the cron or windows scheduled task, convert the md5 list to an array, and then usearray_diff()Compare the md5 list with the currentscandir()The list of obtained md5 files. if any result is returned, the files are modified, deleted, or added.
You can try the mtime and ctime of the Directory.
The Linux kernel has an event-driven Inotify mechanism (C document) that supports listening for directory and file changes.
PHP also has such a PECL extension bound to this Inotify operation.
Http://pecl.php.net/package/ I...
Http://cn.php.net/manual/zh/ B...
Or you can use PHP to call the command tool provided by inotify-tools.
According to the above two brothers, inofiy is used for real-time purposes. if you need to determine the file differences similar to those when submitting code, you can use the md5 value and other file fingerprints.