PHP 8.1.28 Released!

预定义常量

下列常量由此扩展定义,且仅在此扩展编译入 PHP 或在运行时动态载入时可用。

Inotify 常量可用于 inotify_add_watch() 或由 inotify_read() 返回
IN_ACCESS (int)
文件被访问(读)(*)
IN_MODIFY (int)
文件被修改(*)
IN_ATTRIB (int)
元数据变更(例如:权限、修改时间等)(*)
IN_CLOSE_WRITE (int)
打开写入后关闭的文件(*)
IN_CLOSE_NOWRITE (int)
未打开写入的文件被关闭(*)
IN_OPEN (int)
文件被打开(*)
IN_MOVED_TO (int)
文件被移动到监听目录(*)
IN_MOVED_FROM (int)
文件移出监听目录(*)
IN_CREATE (int)
在监听目录中创建文件或文件夹(*)
IN_DELETE (int)
监听目录中删除文件或文件夹(*)
IN_DELETE_SELF (int)
监听的文件或目录被删除
IN_MOVE_SELF (int)
监听的文件或目录被移动
IN_CLOSE (int)
与 IN_CLOSE_WRITE | IN_CLOSE_NOWRITE 相等
IN_MOVE (int)
与 IN_MOVED_FROM | IN_MOVED_TO 相等
IN_ALL_EVENTS (int)
以上所有常量的位掩码
IN_UNMOUNT (int)
卸载包含监听对象的文件系统
IN_Q_OVERFLOW (int)
事件队列溢出(此事件中监听描述符是 -1)
IN_IGNORED (int)
监听被移除(通过 inotify_rm_watch() 显示移除,或者是文件被移动,或者文件系统被卸载)
IN_ISDIR (int)
事件发生的主体是目录
IN_ONLYDIR (int)
如果是目录,仅监听路径名(从 Linux 2.6.15 开始)
IN_DONT_FOLLOW (int)
如果是符号链接,不引用路径名(从 Linux 2.6.15 开始)
IN_MASK_ADD (int)
如果路径名存在,追加监听此路径的事件掩码(代替更换掩码)
IN_ONESHOT (int)
路径触发一个监听事件后,从监听列表中移除。

注意: 以上标有星号 (*) 的事件可能发生在已监听目录的文件中。

add a note

User Contributed Notes 2 notes

up
8
crownedgrouse
15 years ago
Be carefull using IN_MODIFY :

Lot of UNIX editor, for instance like 'vi', work in a 'xxx~' file, and changes are written in 'xxx' when saving or saving and closing.

If a watcher is done on 'xxx', no IN_MODIFY event occurs while not saved !

Prefere IN_CLOSE_WRITE in such case .
up
4
rogere84 at gmail dot com
9 years ago
I noticed that the values of the constants seem to be missing. Granted, these could change dependant on version but on my system here are the values (should you want them).

IN_ACCESS = 1
IN_MODIFY = 2
IN_ATTRIB = 4
IN_CLOSE_WRITE = 8
IN_CLOSE_NOWRITE = 16
IN_OPEN = 32
IN_MOVED_FROM = 64
IN_MOVED_TO = 128
IN_CREATE = 256
IN_DELETE = 512
IN_DELETE_SELF = 1024
IN_MOVE_SELF = 2048
IN_UNMOUNT = 8192
IN_Q_OVERFLOW = 16384
IN_IGNORED = 32768
IN_CLOSE = 24
IN_MOVE = 192
IN_ALL_EVENTS = 4095
IN_ONLYDIR = 16777216
IN_DONT_FOLLOW = 33554432
IN_MASK_ADD = 536870912
IN_ISDIR = 1073741824
IN_ONESHOT = 2147483648
To Top