[英]Deprecated: Implicit conversion from float xx.xxxx to int loses precision in excel_reader2.php on line 922
操作系統:Windows 11 PHP 版本 8.1.6
錯誤消息:已棄用:從 float 65.03846153846153 到 int 的隱式轉換在第 922 行的 C:\xampp\htdocs\sati\import\excel_reader2.php 中失去精度
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);
}
}
任何人都有解決問題的想法?
傳遞給chr()
時,您應該將計算轉換為整數:
strtolower(
(
($i-1)/26>=1
? chr((int) ($i-1)/26+64)
: ''
)
. chr((int) ($i-1)%26+65)
)
固定功能
/**
* Constructor
*
* Some basic initialisation
*/
//function Spreadsheet_Excel_Reader($file='',$store_extended_info=true,$outputEncoding='') { // DEPRECATED EDITED IN 06-2020
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)); // DEPRECATED EDITED IN 07-2022
$name = strtolower(( (($i-1)/26>=1)? chr((int) (($i-1)/26+64)) :'') . chr((int) (($i-1)%26+65)) );
$this->colnames[$name] = $i;
$this->colindexes[$i] = $name;
}
$this->store_extended_info = $store_extended_info;
if ($file!="") {
$this->read($file);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.