它返回一個含有所有文件的列表包含搜索詞語數組。

復制代碼 " /> 午夜福利试看120秒体验区,亚洲欧美国产旡码专区,人妻洗澡被强公日日澡

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

Search File Contents PHP 搜索目錄文本內容的代碼

這個類可以用來搜索在給定的文本目錄中的文件。
它可以給定目錄遍歷遞歸查找某些文件擴展名的文件。
并打開找到的文件,并檢查他們是否包含搜索詞語。

它返回一個含有所有文件的列表包含搜索詞語數組。

復制代碼 代碼如下:
<?php
/*
Class for searching the contents of all the files in a directory and its subdirectories
For support please visit http://www.webdigity.com/
*/
class searchFileContents{
var $dir_name = '';//The directory to search

var $search_phrase = '';//The phrase to search in the file contents
var $allowed_file_types = array('php','phps');//The file types that are searched
var $foundFiles;//Files that contain the search phrase will be stored here
//開源代碼OSphp.COM.Cn
var $myfiles;
function search($directory, $search_phrase){
$this->dir_name = $directory;
$this->search_phrase = $search_phrase;

$this->myfiles = $this->GetDirContents($this->dir_name);
$this->foundFiles = array();
if ( empty($this->search_phrase) ) die('Empty search phrase');

if ( empty($this->dir_name) ) die('You must select a directory to search');
foreach ( $this->myfiles as $f ){
if ( in_array(array_pop(explode ( '.', $f )), $this->allowed_file_types) ){ //開源OSphp.COM.CN
$contents = file_get_contents($f);
if ( strpos($contents, $this->search_phrase) !== false )
$this->foundFiles [] = $f;
//開源代碼OSphp.COm.CN

}
}
return $this->foundFiles;
}
function GetDirContents($dir){
if (!is_dir($dir)){die ("Function GetDirContents: Problem reading : $dir!");}
if ($root=@opendir($dir)){
//php開源代碼

while ($file=readdir($root)){
if($file=="." || $file==".."){continue;}
if(is_dir($dir."/".$file)){

$files=array_merge($files,$this->GetDirContents($dir."/".$file));
}else{
$files[]=$dir."/".$file; //開源OSphp.COM.CN
}
}
}
return $files;
}
}
//Example :
$search = new searchFileContents;
$search->search('E:/htdocs/AccessClass', 'class'); //開源代碼OSphp.COM.Cn
var_dump($search->foundFiles);
?>

php技術Search File Contents PHP 搜索目錄文本內容的代碼,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 老师给美女同学开嫩苞 | bbwxxxx交女警| 成人小视频在线观看 | 新新电影理论中文字幕 | 999久久久国产 | 精品国产麻豆免费人成网站 | 亚洲视频欧美视频 | 精品欧美18videosex欧美 | 久久久久久天天夜夜天天 | 永久午夜福利视频一区在线观看 | 国产互换后人妻的疯狂VIDEO | 99久久婷婷国产麻豆精品电影 | 暖暖日本在线手机免费完整版 | 最近更新2019中文字幕免费 | 久热人人综合人人九九精品视频 | 亚洲 欧美 国产 综合 在线 | 久久精品国产免费播放 | 国产成人无码一区AV在线观看 | 日本福利片午夜免费观着 | 久久成人精品免费播放 | 一线高清视频在线播放 | 伊人久在线| av天堂电影网在线观看 | 日韩av国产av欧美天堂社区 | 麻豆影视在线直播观看免费 | 北原夏美 快播 | 日韩黄色软件 | 欧美日韩一二区旡码高清在线 | 色情www日本欧美 | 果冻传媒在线观看网站 | 亚洲日本欧美国产在线视 | 国产精品线路一线路二 | 高清不卡伦理电影在线观看 | 青春草国产成人精品久久 | 久久综合中文字幕无码 | 欧洲电影巜肉欲丛林 | 国产精品欧美一区二区在线看 | 青青草 久久久 | 亚洲欧美一区二区三区蜜芽 | 9国产露脸精品国产麻豆 | 俄罗斯人与动ZOZ0 |