时间:2021-07-01 10:21:17 帮助过:7人阅读
如题.
表格内容
include_once('includes/PHPExcel.php');
$uploadfile = xxx;
$type = strtolower( pathinfo($uploadfile, PATHINFO_EXTENSION) );
if ($type == 'xls' || $type == 'xlsx') {
$objPHPExcel = PHPExcel_IOFactory::load($uploadfile)
} else if ($type == 'csv') {
$objReader = PHPExcel_IOFactory::createReader('CSV')
->setDelimiter(',')
->setInputEncoding('GBK') //不设置将导致中文列内容返回boolean(false)或乱码
->setEnclosure('"')
->setLineEnding("\r\n")
->setSheetIndex(0);
$objPHPExcel = $objReader->load($uploadfile);
}
$sheet = $objPHPExcel->getSheet(0);
$plaintext = $sheet->getComment("A1");
echo $plaintext;
$plaintext值为乱码
如题.
表格内容
include_once('includes/PHPExcel.php');
$uploadfile = xxx;
$type = strtolower( pathinfo($uploadfile, PATHINFO_EXTENSION) );
if ($type == 'xls' || $type == 'xlsx') {
$objPHPExcel = PHPExcel_IOFactory::load($uploadfile)
} else if ($type == 'csv') {
$objReader = PHPExcel_IOFactory::createReader('CSV')
->setDelimiter(',')
->setInputEncoding('GBK') //不设置将导致中文列内容返回boolean(false)或乱码
->setEnclosure('"')
->setLineEnding("\r\n")
->setSheetIndex(0);
$objPHPExcel = $objReader->load($uploadfile);
}
$sheet = $objPHPExcel->getSheet(0);
$plaintext = $sheet->getComment("A1");
echo $plaintext;
$plaintext值为乱码