我正在尝试将数据导出到excel,表格可以工作,但是语言无法显示
在utf-8中,我是SET CHARACTER SET UTF-8,但它不起作用 我的第一个代码有2个文件
<form action="/question_export.php" method="post">
<button type="submit" id="export_data" name='export_data' value="Export to excel" class="btn btn-info">تنزيل</button>
</form>
第二个代码文件是
require_once 'config.php';
$newArray = questions::getAssoc("SELECT * FROM question");
if(isset($_POST["export_data"])) {
$filename = "export_".date('Ymd') . ".xls";
header("Content-Type: application/vnd.ms-excel;charset=UTF-8");
header("Content-Disposition: attachment; filename=\"$filename\"");
//echo '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';
//echo "\xEF\xBB\xBF"; // UTF-8 BOM
$show_coloumn = false;
if(!empty($newArray)) {
foreach($newArray as $record) {
if(!$show_coloumn) {
// display field/column names in first row
echo implode("\t", array_keys($record)) . "\n";
$show_coloumn = true;
}
echo implode("\t", array_values($record)) ."\n";
}
}
exit;
}