Home  >  Article  >  Backend Development  >  php搜索txt内容,该如何处理

php搜索txt内容,该如何处理

WBOY
WBOYOriginal
2016-06-13 13:50:051320browse

php搜索txt内容
编写一个小程序,搜索内容
如A.txt中有
NAME:彬
SEX:男
等信息
读取每一条到数据库中、
有大量这种的文档,求帮助!!!

------解决方案--------------------
opendir() 列出所有文件名,进行循环

读txt(fopen fgets,文件小的话,可以直接用file_get_contents()),进行分析,保存进数据库,具体的请参考相关函数.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn