我在 excel 文件中遇到這個問題,該值是 1.93E+11 并且當我將 csv 導入 MYSQL 表時它沒有轉(zhuǎn)換為 193000000000。它的值與 1.93E+11 相同我該怎么做才能將其轉(zhuǎn)換為我的代碼 if ($_FILES["file"]["size"] > 0) { $file = fopen($fileName, "r"); while (($column = fgetcsv($file, 58000, ",")) !== FALSE) { $sqlInsert = "INSERT into excel () values ('" . $column[0] . "','" . $column[1] . "')"; $result = mysqli_query($conn, $sqlInsert); if (! empty($result)) { $type = "success"; $message = "CSV Data Imported into the Database";
1 回答

慕運維8079593
TA貢獻1876條經(jīng)驗 獲得超5個贊
您可以將其類型轉(zhuǎn)換為浮點數(shù):
$value = (float) $column[1];
為了確保你確實有一個浮點數(shù),你可以嘗試像這樣檢查
if (is_numeric($column[1]) && !is_int($column[1])) {
$value = (float) $column[1];
}
- 1 回答
- 0 關(guān)注
- 94 瀏覽
添加回答
舉報
0/150
提交
取消