PHPEXCEL集合UTF-8编码
我有标题:PHPEXCEL集合UTF-8编码,php,header,phpexcel,Php,Header,Phpexcel,我有标题: header('Content-Type: text/html; charset=UTF-8'); header("Content-type: application/octetstream"); header('Content-Disposition: attachment; filename="export.csv"'); 但解码不正确如果我在excel show的数据库中有word“Pagrindinė”
header('Content-Type: text/html; charset=UTF-8');
header("Content-type: application/octetstream");
header('Content-Disposition: attachment; filename="export.csv"');
但解码不正确如果我在excel show的数据库中有word“Pagrindinė”“PagrindinÄ”,我的标题有什么问题
我的头怎么了
没什么,你的头看起来不错
Excel有什么问题
在Excel中打开文件的用户需要告诉Excel该文件采用UTF-8编码。指示该用户联系其用于支持选项的软件供应商
顺便说一句,它的用户或其派生用户没有这个问题,因此一个解决方案是告诉他们安装一套这样的软件,例如打开CSV文件并将其保存为Excel文件
或者您可以直接在服务器上创建Excel文件。如果您在保存.php文件时将其格式文本编码更改为Unicode(UTF-8)。它对我有用 希望有帮助。试试这个:
header('Content-Transfer-Encoding: binary');
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
header('Content-Disposition: attachment; filename = "Export '.date("Y-m-d").'.xls"');
header('Pragma: no-cache');
//these characters will make correct encoding to excel
echo chr(255).chr(254).iconv("UTF-8", "UTF-16LE//IGNORE", $out);
所以你要输出一个CSV?还是使用PHPExcel创建的Excel文件?它是什么?重复:您是否实际使用PHPExcel库创建csv文件?