doulu6160 2012-10-05 05:44
浏览 24
已采纳

用php中的inotify读取linux中的文件

I need to read a file in linux when changes are made to it and output the contents of the file to php. I read about inotify and i think it's the one i'm looking for. I don't understand it well. do i need to install inotify in linux so i can use inotify in php?.. if possible can you show me a quick example of how i use it in php for reading/tailing a file in php for events that occured in the file?.

Thanks,

  • 写回答

1条回答 默认 最新

  • douyong1886 2012-10-05 17:33
    关注

    You can use shell/bash in PHP:

    $shell = shell_exec("cat file");
    print $shell
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站