Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我像这样设置单元格值时
->setCellValue('O' . $currentRow, 12000000000000111702)
或者
->setCellValue('O' . $currentRow, "12000000000000111702")
它正在生成值 1.2E+19 即 12000000000000000000 谁能告诉我原因?
如果您需要将此值完全“按原样”保留而不是转换为浮点数(因为它对于 PHP int 来说太大了),那么您需要使用显式将该值设置为字符串
->setCellValueExplicit('O' . $currentRow, "12000000000000111702", PHPExcel_Cell_DataType::TYPE_STRING)
您实际上不需要指定 PHPExcel_Cell_DataType::TYPE_STRING 因为 setCellValueExplicit() 无论如何都默认为该值。