有没有办法通过 apache/.htaccess 请求将 csv 文件转换为 excel 文件
最佳答案
使用 PHPExcel
include 'PHPExcel/IOFactory.php';
$objReader = PHPExcel_IOFactory::createReader('CSV');
// If the files uses a delimiter other than a comma (e.g. a tab), then tell the reader
$objReader->setDelimiter("\t");
// If the files uses an encoding other than UTF-8 or ASCII, then tell the reader
$objReader->setInputEncoding('UTF-16LE');
$objPHPExcel = $objReader->load('MyCSVFile.csv');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('MyExcelFile.xls');
关于php - csv 到 excel 转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3874840/