All Projects → swoole → Auto_reload

swoole / Auto_reload

Inotify监控文件变更自动重启swoole_server

自动重启脚本

  • 使用inotify监听PHP源码目录
  • 程序文件更新时自动reload服务器程序

运行脚本

依赖inotifyswoole扩展

pecl install swoole
pecl install inotify
php daemon.php

运行程序

require __DIR__.'/src/Swoole/ToolKit/AutoReload.php';

//设置服务器程序的PID
$kit = new Swoole\ToolKit\AutoReload(2914);
//设置要监听的源码目录
$kit->watch(__DIR__.'/tests');
//监听后缀为.php的文件
$kit->addFileType('.php');
$kit->run();

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].