1
私は単純なCSVをエクスポートするプロジェクトに取り組んでいます。これまでのところ、私のコードは英語の文字を使用している限りCSVを生成して生成します。フランス語の文字をエンコードする、csv - PHP
一部の列名はフランス語であり、それをエンコードすることができます。ここで
は私が持っているものです:いくつかの周りを確認した後
<?php
// open the file "demosaved.csv" for writing
$file = fopen('myfrench-export.csv', 'w');
// save the column headers
fputcsv($file, array('Question', 'Réponse 1/4', 'Réponse 2/4', 'Réponse 3/4', 'Réponse 4/4', 'Total completé', 'Total non-completé', 'Total cumulatif'));
// Sample data. This can be fetched from mysql too
$data = array(
array('Data 11', 'Data 12', 'Data 13', 'Data 14', 'Data 15'),
array('Data 21', 'Data 22', 'Data 23', 'Data 24', 'Data 25'),
array('Data 31', 'Data 32', 'Data 33', 'Data 34', 'Data 35'),
array('Data 41', 'Data 42', 'Data 43', 'Data 44', 'Data 45'),
array('Data 51', 'Data 52', 'Data 53', 'Data 54', 'Data 55'),
array('Data 51', 'Data 52', 'Data 53', 'Data 54', 'Data 55'),
array('Data 51', 'Data 52', 'Data 53', 'Data 54', 'Data 55'),
array('Data 51', 'Data 52', 'Data 53', 'Data 54', 'Data 55'),
);
// save each row of the data
foreach ($data as $row)
{
fputcsv($file, $row);
}
// Close the file
fclose($file); ?>
** "Réponse3/4" **の代わりに** "Réponse3/4" **としてフランス語のテキストをエンコードする原因は何ですか? – codiiv
あなたはどんなOSをコードしていますか?そしてあなたのコードはどのOSで動作しますか? – MacPrawn
私はWindows 10でコード化し、コードはXampp上でローカルに実行され、Wordpress App上でAzure上ではリモートで実行されます。それは問題ですか? – codiiv