private static function initEvents() { //扫描文件夹下的所有文件 $files = scandir(__DIR__ . '/EventHandlers'); foreach($files as $file) { if($file != '.' && $file != '..') { include_once(__DIR__ . '/EventHandlers/' . $file); //调用文件的静态方法 call_user_func(pathinfo($file, PATHINFO_FILENAME) . '::onWorkerStart'); } } }