0

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

ご覧のとおり、名前には日本語が表示されず、意味不明に表示されます。

4

1 に答える 1

1

上記のリンクを共有していただきありがとうございます

私は単にエコーアウトしました

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

残りはうまくいきました!

于 2013-01-08T10:35:54.100 に答える