php - 在 linux 中使用 inotify 在 php 中读取文件

标签 php linux

当对文件进行更改时,我需要在 linux 中读取文件并将文件的内容输出到 php。我阅读了有关 inotify 的信息,我认为这是我正在寻找的。我不太明白。我需要在 linux 中安装 inotify 以便我可以在 php 中使用 inotify 吗?..如果可能的话,你能给我一个快速示例,说明我如何在 php 中使用它来读取/跟踪文件中发生的事件的 php 文件吗? .

谢谢,

最佳答案

您可以在 PHP 中使用 shell/bash:

$shell = shell_exec("cat file");
print $shell

关于php - 在 linux 中使用 inotify 在 php 中读取文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12740179/

相关文章:

linux - 批量删除文件

涉及 vector 的 C++ 代码在 visual studio 上运行良好,但在 linux 上运行不佳

php - 如何在php中实现mysql compress()函数

php - 如何使用 PHP 修剪文本

android - Phonegap : Getting Started with Android?——在 Linux 上

linux - 在 Linux 命令行中调用 R 函数

linux - Python 脚本不发送 linux 命令。我使用 Paramiko 进行远程 SSH 连接

php - 短代码输出显示在页面顶部

php - 我的代码对 SQL 注入(inject)有多脆弱?

php - MySQL,我怎样才能使这个查询更快?