即把這段代碼:
if (fwrite($handle_result, $buffer) === FALSE) {
echo "1 record failed to write into log.
";
}
else
{
echo "1 record susseccful to write into log.
";
}
替換成:
$result .= $buffer . "\r\n";
$i++;
然後在while循環之前加上:
/*初始化變量*/
$result = "";
$i = 0;
在循環結束後加上:
if (fwrite($handle_result, $result) === FALSE) {
echo "Failed to write into log.
";
}
else
{
echo "$i records have been written into log susseccfully.
";
}