php导出excel中,若数据库一列内容中存在换行,则在excel中对应换成多行,如何解决?
php导出excel中,若数据库一列内容中存在换行,则在excel中对应换成多行,如何解决?
代码如下:
<?php <br />//验证是否已登录<br />include 'remember_password.php';<br /> header("Accept-Ranges: bytes");<br /> header("Content-type: application/vnd.ms-excel");<br /> header("Content-Disposition: attachment; filename=".$filename);<br /> include("connect.php");<br /> $sql="select * from specific_step";<br /> $query = mysql_query($sql);<br /> echo "序号\t业务名称\t操作步骤\t备注\t录入人\t录入日期";<br /> while($row = mysql_fetch_array($query)){<br /> echo "\n";<br /> echo $row['serial_number']."\t".$row['name']."\t".$row['step']."\t".$row['other']."\t".$row['input_name'].<br /> "\t".$row['input_date'];<br /> }<br />?>
header("Accept-Ranges: bytes");<br />header("Content-type: application/vnd.ms-excel");<br />header("Content-Disposition: attachment; filename=".@$filename);<br /><br />$ar = array(<br /> "abcd<br />123",<br /> "再来一段<br />换行<br />再换行"<br />);<br />echo "序号\t备注\n";<br />foreach($ar as $k=>$v) {<br /> echo "$k\t\"$v\"\n";<br />}