😊 Thinkphp下 Gateway-woker实现热重载
Security Classification: 【C-1】 | Publish Time:2024-02-20 | Category:Coding | EditExpiry Notice: The article was published three months ago. Please independently assess the validity of the technical methods and code mentioned within. :)
AI Summary: 该文章介绍了一个PHP类`Push`,它利用GatewayWorker框架实现了文件监控和推送功能。在`onWorkerStart`事件中,启动了一个定时器,每秒检查指定目录(`/app/app/index/controller`)下的PHP文件是否有更新。如果发现文件的修改时间晚于上次记录的时间,便打印出更新信息并向主进程发送SIGUSR1信号以实现重新加载。还定义了`onConnect`和`onMessage`方法,用于处理客户端连接和消息发送。 --- (From Model:gpt-4o-mini-2024-07-18)
Comment List
感谢!!找了很久
不客气呢