Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我怎样才能另存为;带BOM的UTF-8;编码?_Php_Codeigniter_Encoding_Utf 8 - Fatal编程技术网

Php 我怎样才能另存为;带BOM的UTF-8;编码?

Php 我怎样才能另存为;带BOM的UTF-8;编码?,php,codeigniter,encoding,utf-8,Php,Codeigniter,Encoding,Utf 8,我正在生成csv文件,但它另存为“UTF-8无BOM” 如何保存为“带BOM的UTF-8”? 我在codeigniter中使用以下标题 header('Content-Type: text/csv;charset=utf-8'); 这已经是 但是,您需要包括一个。这可以通过以下方式完成: 这已经是 但是,您需要包括一个。这可以通过以下方式完成: <?php header('Content-Description: File Transfer'); header('Conten

我正在生成csv文件,但它另存为“UTF-8无BOM”

如何保存为“带BOM的UTF-8”?

我在codeigniter中使用以下标题

 header('Content-Type: text/csv;charset=utf-8');

这已经是

但是,您需要包括一个。这可以通过以下方式完成:


这已经是

但是,您需要包括一个。这可以通过以下方式完成:


<?php

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=<a filename>.csv');
header('Content-Transfer-Encoding: binary');

echo "\xEF\xBB\xBF"; // Byte Order Mark
echo $the_csv_file_content;
exit();

?>