PHP: Export chinese and Spanish data excel
I want to export mysql data to excel through PHP. I am doing with fol开发者_JS百科lowing code.
$filename = "contact_data_" . @date('Ymd') . ".xls";
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Type: application/vnd.ms-excel");
This works fine with English characters but Chinese characters appear weird. For example 我们将尽快与您联系 appear as 我们将尽快与您è”ç³» in generated excel.
I have tried with changing charset to UTF-8 also but didn't help.
Many thanks.
$filename = "contact_data_" . @date('Ymd') . ".xls";
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Type: application/vnd.ms-excel");
This baby can export mysql to excel? I don't think so. It's definitely not doing the magic, check again, pal.
精彩评论