php如何将mysql数据库中的文件导出到文本文件
$myFile="testFile.txt";$fh=fopen($myFile,'w');$write="";foreach($rowas$key=>$vol){$wr...
$myFile="testFile.txt";
$fh=fopen($myFile,'w');
$write="";
foreach($row as $key=>$vol){
$write=$write.$vol;
fwrite($fh,$write);
echo "<br>";
echo $write;
echo "<br>";
}
echo "<br>";
fclose($fh);
echo "write to outputfile" .$myFile. "ok.";
这里只能导出数据库中最后一条记录,我想把每一条记录都导出来,怎么办? 展开
$fh=fopen($myFile,'w');
$write="";
foreach($row as $key=>$vol){
$write=$write.$vol;
fwrite($fh,$write);
echo "<br>";
echo $write;
echo "<br>";
}
echo "<br>";
fclose($fh);
echo "write to outputfile" .$myFile. "ok.";
这里只能导出数据库中最后一条记录,我想把每一条记录都导出来,怎么办? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询