使用此 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
有任何想法吗?