PHP来搜索30,000个文本文件 [英] PHP to search inside 30,000 text files

查看:180
本文介绍了PHP来搜索30,000个文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大约30,000个文本文件的目录,我想在每个文件里面查找是否包含指定的文本。如何在PHP中有效地做到这一点?

朋友。如果出于某种原因,您需要PHP脚本中的结果,那么您可以使用允许执行外部命令的PHP函数之一来调用它。


I have a directory of about 30,000 text files and I'd like to search inside each to find if they contain a specified text. How can I do this effectively in PHP?

解决方案

grep is your friend. You can use one of php's functions that allow execution of external commands to call it, if for some reason you need the result inside a PHP script.

这篇关于PHP来搜索30,000个文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆