PHP code example of wslibs / php-monitor-file

1. Go to this page and download the library: Download wslibs/php-monitor-file library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wslibs / php-monitor-file example snippets



use wslibs\php_monitor_file\MonitorFile;

$files = [__DIR__.DIRECTORY_SEPARATOR."test",  __DIR__.DIRECTORY_SEPARATOR."test1"];
/*
    ps:建议加入定时任务,定期执行,执行结果可以去日志目录查看,短信通知,邮件通知等功能可以自行拓展

    $dirs array : 要监控的文件目录
    $log_dir string : 存放监控日志的目录
    $type int : 1:文件md5检测法 2:git检测法
    $_ignore_files_array array : 屏蔽的日志文件
*/
MonitorFile::start($files , __DIR__.DIRECTORY_SEPARATOR."log",1/*,['apidoc.json']*/);