この sctip を使用してテキスト ファイルを消去します。
$list = file_get_contents('file.txt');
$res = preg_match_all("/\d+\.\d+\.\d+\.\d+\:\d+/", $list, $match);
if($res) {
foreach($match[0] as $value)
$listValue .= $value."\n";
file_put_contents('file.txt', trim($listValue));
}
動作していますが、ログに次のエラー メッセージが表示されます。
Notice: Undefined variable: listValue in /home/local/public_html/scripts/extractor.php on line 22
何か案は?