我正在加载一个包含一些长数字的简单CSV文件。
-5605138260238298086
-5605138260238298086
-5605138260238297950
-5605138260238297950
-5605138260238297950
-5605138260238297950
-5604797085080996904
尝试对此CSV进行基本加载会导致以科学计数形式返回的数字,例如:
-5,60514E+18
如何避免以科学计数法获得打印输出?
我尝试了以下方法:
if ( $ext == 'csv' ) {
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Csv");
} else {
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx");
}
$spreadsheet = $reader->load( $movefile['file'] );
$data = $spreadsheet->getActiveSheet()->toArray();
foreach ( $data as $row_key => $row ) {
foreach ( $row as $cell_key => $cell ) {
if ( $cell )
$file_data[$row_key][$cell_key] = $cell;
}
}