我正在嘗試將數(shù)據(jù)從MySQL導出到xlsx,但是在我的數(shù)據(jù)庫中可能會有一些0和1而不是實際數(shù)據(jù)。讓我更好地解釋一下:有一個列用于設置白天還是晚上,但白天使用0,夜晚使用1。當我使用下面的代碼導出時,我得到一個帶有這些0和1的xlsx。已經(jīng)嘗試過的東西,例如https://phppot.com/php/database-data-export-to-excel-file-using-php/和https://artisansweb.net/how-to-export-mysql-database-data -to-excel-using-php /但在發(fā)送之前我無法編輯xlsx的內(nèi)容 $filename = "Export_excel.xls"; header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=\"$filename\""); $isPrintHeader = false; if (! empty($productResult)) { foreach ($productResult as $row) { if (! $isPrintHeader) { echo implode("\t", array_keys($row)) . "\n"; $isPrintHeader = true; } echo implode("\t", array_values($row)) . "\n"; } }當代碼看到零時,我想將其設置為“ day”
如何將數(shù)據(jù)從MySQL導出到Excel(.xlsx),但在導出之前處理數(shù)據(jù)
慕田峪9158850
2021-04-28 14:41:59