您的两个选项是DirectoryIterator或glob:
$string = 'something';$dir = new DirectoryIterator('some_dir');foreach ($dir as $file) { $content = file_get_contents($file->getPathname()); if (strpos($content, $string) !== false) { // Bingo }}$dir = 'some_dir';foreach (glob("$dir/*") as $file) { $content = file_get_contents("$dir/$file"); if (strpos($content, $string) !== false) { // Bingo }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)