2019-09-06 23:53:10 +08:00

16 lines
451 B
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
//创建一个inotify句柄
$fd = inotify_init();
//监听文件仅监听修改操作如果想要监听所有事件可以使用IN_ALL_EVENTS
$watch_descriptor = inotify_add_watch($fd, __DIR__.'/inotify.data', IN_MODIFY);
swoole_event_add($fd, function ($fd) {
$events = inotify_read($fd);
if ($events) {
foreach ($events as $event) {
echo "inotify Event :" . var_export($event, 1) . "\n";
}
}
});