PHP逐行读取匹配内容
2018-10-25 本文已影响0人
长安猎人
$filename = 'log';
$handle = fopen($filename, 'r');
while(!feof($handle)) {
$buffer = fgets($handle, 4096);
$text = trim($buffer);
if(strpos($text, '@sina')) {
echo $text;
}
}
fclose($handle);