【问题标题】:Export CSV by PHP for utf-8 characters通过 PHP 为 utf-8 字符导出 CSV
【发布时间】:2012-05-08 20:13:37
【问题描述】:

标签: php excel csv header


【解决方案1】:

我是这样做的。

header('Content-Encoding: UTF-8');
header('Content-type: text/csv; charset=UTF-8');
header("Content-Disposition: attachment; filename=file.csv");
header("Pragma: no-cache");
header("Expires: 0");
header('Content-Transfer-Encoding: binary');
echo "\xEF\xBB\xBF";

之前我得到的是垃圾字符,现在导出了正确的数据。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-09
    • 2011-11-16
    相关资源
    最近更新 更多