Maison  >  Questions et réponses  >  le corps du texte

Obsolète : la conversion implicite de float xx.xxxx en int perd la précision de la ligne excel_reader2.php 922

Système d'exploitation : Windows 11 PHP version 8.1.6

Message d'erreur : DÉCONSEILLÉ : la conversion implicite de float 65.03846153846153 en int perd la précision C:xampphtdocssatiimportexcel_reader2.php ligne 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);
  }
}

Quelqu'un a-t-il une solution à ce problème ?

P粉654894952P粉654894952263 Il y a quelques jours535

répondre à tous(1)je répondrai

  • P粉563831052

    P粉5638310522024-01-05 10:07:56

    Oui, c'est obsolète

    Lorsque vous passez à chr(), vous devez convertir le résultat du calcul en un entier :

    strtolower(
        (
            ($i-1)/26>=1
                ? chr((int) ($i-1)/26+64)
                : ''
        )
        . chr((int) ($i-1)%26+65)
    )
    

    répondre
    0
  • Annulerrépondre