<?php
header('Content-Type: text/html; charset=utf-8');
$directory = 'C:\Users\Administrator\Desktop\cost';
$files = scandir($directory);
$searchTerm = 'INSERT INTO `sx_cost`';
$fileee = fopen('C:\Users\Administrator\Desktop\putcost.txt', "a");//要写入的文件
foreach ($files as $filee) {
if ($filee !== '.' && $filee !== '..') {
$file = fopen('C:\Users\Administrator\Desktop\cost\/'.$filee,'r');
while (($line = fgets($file)) !== false) {
// 检查当前行是否包含要查找的字符
if (strpos($line, $searchTerm) !== false) {
echo $line;
// 输出该行的数据
fwrite($fileee,$line.";");
}
}
}
}
事件:数据表被清除。通过binlog日志找到insert的sql