2017-06-17 78 views
-1

我從無處獲得這些錯誤...出了什麼問題?線條有什麼問題? (php)

警告: /家被零除/ /的public_html /可溼性粉劑內容/插件/ /includes/classes/controller/SearchPageController.php 線60上

警告:提供參數無效在 /home/vineanimals/public_html/wp-content/plugins/*/includes/classes/controller/ImportPageController.php 的foreach()在線路70上

警告:array_merge():參數#1不是陣列在 /h OME//的public_html /可溼性粉劑內容/插件/ /includes/classes/controller/AImportPageController.php 上線75個

線路碼:

線60:$last = ceil($load_products_result['total']/$load_products_result['per_page']);

線70 -75:

foreach ($product['sku_products']['variations'] as $var) { 
        if (isset($var['image'])) { 
         $product['all_images'][] = $var['image']; 
        } 
       } 
       $product['all_images'] = array_merge($product['all_images'], $this->woocommerce_model->get_images_from_description($product['description'])); 
      } 
+2

隨着誤差是很清楚的,可以通過0有一個除法問題在你的代碼中。 –

+3

疑難解答101:檢查所有這些變量,你會發現load_prdoucts_result ['per_page']設置爲0.查克諾里斯是唯一可以被零除的人。 – mkaatman

回答

0

A)檢查您的SQL查詢或陣飼料

B)然後改變

$last = ceil($load_products_result['total']/$load_products_result['per_page']); 

到:

$last = (isset($load_products_result['per_page']) ? ceil($load_products_result['total']/$load_products_result['per_page']) : 0) 

C)和更改,如下所述的foreach:

if (is_array($product['sku_products']['variations'])){ 
    foreach ($product['sku_products']['variations'] as $var) { 
      if (isset($var['image'])) { 
       $product['all_images'][] = $var['image']; 
      } 
     } 
    if (isset($product['description']) && is_array($product['all_images']) && is_array($this->woocommerce_model->get_images_from_description($product['description']))) 
    $product['all_images'] = array_merge($product['all_images'], $this->woocommerce_model->get_images_from_description($product['description'])); 
} 
+0

我的意思不是那個 –

+0

呵呵? C不起作用:s –

+0

錯誤是什麼? –