已棄用:從 float xx.xxxx 到 int 的隱式轉換會遺失 excel_reader2.php 第 922 行的精確度
P粉654894952
P粉654894952 2024-01-04 12:03:28
0
1
528

作業系統:Windows 11 PHP版本8.1.6

錯誤訊息: 已棄用:從 float 65.03846153846153 到 int 的隱式轉換會遺失 C:xampphtdocssatiimportexcel_reader2.php 第 922 行的精確度

public function __construct($file='',$store_extended_info=true,$outputEncoding='') {

  $this->_ole = new OLERead();
  $this->setUTFEncoder('iconv');
  if ($outputEncoding != '') { 
    $this->setOutputEncoding($outputEncoding);
  }
  for ($i=1; $i<245; $i++) {
    $name = strtolower(( (($i-1)/26>=1)?chr(($i-1)/26+64):'') . chr(($i-1)%26+65));  //line 922
    $this->colnames[$name] = $i;
    $this->colindexes[$i] = $name;
  }
  $this->store_extended_info = $store_extended_info;
  if ($file!="") {
    $this->read($file);
  }
}

有人有辦法解決這個問題嗎?

P粉654894952
P粉654894952

全部回覆(1)
P粉563831052

是的,它已被棄用

在傳遞給 chr() 時,您應該將計算結果轉換為整數:

strtolower(
    (
        ($i-1)/26>=1
            ? chr((int) ($i-1)/26+64)
            : ''
    )
    . chr((int) ($i-1)%26+65)
)
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!