导出excel表时本来是一个字段里的内容,导出初时却到了第二行

WBOY
Release: 2016-06-13 12:20:24
Original
1205 people have browsed it

导出excel表时本来是一个字段里的内容,导出来时却到了第二行
//开始导出
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:attachment;filename=xueyuan_list_data.xls");

echo mb_convert_encoding('备注','GBK','UTF-8')."\t";

$xuhao = 1;
foreach($arr_xueyuan_list as $arr)
{
echo "\n";
echo $xuhao . "\t";
echo mb_convert_encoding($arr['beizhu'],'GBK','UTF-8') ."\t";
$xuhao = $xuhao + 1;
}

由于数据beizhu在提交时是textarea,所以beizhu这个字段中会含有换行符,导出时,一旦内容里有换行的,那么第二行就会显示到excel表的另一行去,但我想要的是beizhu这个字段里的所有内容只显示在excel表里的“备注”这一格里,请问应该怎么办?
------解决思路----------------------
测试了一下,不必替换回车换行
只需将输出串用双引号包裹起来就可以了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!