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);
上一篇 下一篇

猜你喜欢

热点阅读