如题.
表格内容
<code>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;</code>
$plaintext值为乱码
如题.
表格内容
<code>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;</code>
$plaintext值为乱码