简体   繁体   English

警告:第162行在PHP中被零除

[英]Warning: Division by zero in PHP on line 162

I have this error on my site: 我的网站上出现此错误:

ERR (3): Warning: Division by zero in public_html/app/code/community/VES/PdfProProcessor/Pdf/include/table_frame_reflower.cls.php on line 162 ERR(3):警告:在162行的public_html / app / code / community / VES / PdfProProcessor / Pdf / include / table_frame_reflower.cls.php中被零除

at that line I have the following code: 在那一行,我有以下代码:

  $increment = 0;

  // Case 1:
  if ( $absolute_used == 0 && $percent_used == 0 ) {
    $increment = $width - $min_width;

    foreach (array_keys($columns) as $i) {
      $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment * ($columns[$i]["max-width"] / $max_width));
    }
    return;
  }

how I can solve this error? 我该如何解决这个错误?

try this 尝试这个

  $increment = 0;
  $max_width or $max_width=1;

  // Case 1:
  if ( $absolute_used == 0 && $percent_used == 0 ) {
    $increment = $width - $min_width;

    foreach (array_keys($columns) as $i) {
      $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment * ($columns[$i]["max-width"] / $max_width));
    }
    return;
  }

Your $max_width variable is either not assigned, or holds the value of zero. 您的$max_width变量未分配,或者为零。 If that does not appear to be the case, try echo ing this variable's value inside your if statement. 如果情况并非如此,请尝试在if语句中echo此变量的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM