我已经使用codeigniter完成了下载模板(带有示例数据)的代码。但是当标题或单元格值包含空格时,下载的csv文件包含双引号。这是我的代码:
#image-1{
position: absolute;
width: 100%;
height: 350px;
background-image: url(../images/ecommerce2.jpg);
background-repeat: no-repeat;
background-position: left bottom;
background-size: auto 200px;
top: -100px;
left: -25px;
}
#image-2{
position: absolute;
width: 100%;
height: 190px;
background-image: url(../images/ecommerce1.jpg);
background-repeat: no-repeat;
background-position: left bottom;
background-size: 50% 200px;
top: 80%;
margin-top: -90px;
}
当我下载csv文件时,它是这样的:
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=teacher_template.csv');
$output = fopen('php://output', 'w');
fputcsv($output, array('first name','middlename'));
fputcsv($output, array('Johnthomas ','xx yy'));
我不能改变我的标题和细胞值请帮助
答案 0 :(得分:0)
fputcsv($output, array('first name','middlename','',chr(0)));
fputcsv($output, array('Johnthomas ','xx yy',',',chr(0)));
它会帮助你