public function ss()
{
$path = 'G:\PHP\Goods\uploads\20190715\4ff70347056c40876cda40e2f2fde18c.csv';
try {
//注意 setInputEncoding('GBK') 不設置將導致中文列內容返回boolean(false)或亂碼
$objReader = \PHPExcel_IOFactory::createReader('CSV')->setDelimiter(',')->setInputEncoding('GBK');
$objPHPExcel = $objReader->load($path);
$sheet = $objPHPExcel->getSheet(0); // 讀取第一個工作表
$highestRow = $sheet->getHighestRow(); // 取得總行數
$highestColumm = $sheet->getHighestColumn(); // 取得總列數
$str = "";
for ($row = 1; $row <= $highestRow; $row ++) { // 行數是以第1行開始
$str .= $row;
// 輸出excel表格的內容
for ($column = 'A'; $column <= $highestColumm; $column ++) {
$str .= $sheet->getCell($column . $row)->getValue() . "|";
}
$str .= '|' . PHP_EOL;
}
echo $str;
} catch (\Exception $e) {
$this->error($e->getMessage());
}
return;
}