简体   繁体   English

php用日语创建csv文件

[英]php create csv file with Japanese language

I have a php script that creates csv files: 我有一个创建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);

example of the results in the csv file: 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

as you can see the name doesnt display the Japanese it displays gibrish. 如您所见,该名称不显示日语,显示不整洁。

Thanks for sharing the link above 感谢您分享上面链接

I simply echoed out 我只是回声

    echo chr(0xEF).chr(0xBB).chr(0xBF);

and the rest worked just fine! 其余的一切都很好!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM