我有一个创建csv文件的php脚本:
header('Expires: 0');
header('Cache-control: private');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.ms-excel; charset=utf-8');
header('Content-disposition: attachment; filename="deposits_withdrawals.csv"');
header('Content-Transfer-Encoding: binary');
apache_setenv('no-gzip', 0);
@ini_set('zlib.output_compression', 1);
@ini_set('implicit_flush', 1);
for ($i = 0; $i < ob_get_level(); $i++) { @ob_end_flush(); }
ob_implicit_flush(1);
csv文件中的结果示例:
Account ID Name requestDate Type Method Amount
22 ‚ ‚³‚ 31/07/2012 04:42 deposit Bonus 10,000
22 ‚ ‚³‚ 31/07/2012 04:36 deposit Wire 100,000
你可以看到这个名字并没有显示日语显示的gibrish。