-1
我不斷收到試圖產品圖片導出LemonStand如果出現以下錯誤:PHP錯誤:未定義偏移:1 - LemonStand產品出口
Phpr_PhpException: Undefined offset: 1. In /public_html/store/modules/shop/classes/shop_productexport.php, line 158
這裏是有問題的代碼:
// Images should be separated by newlines, and each should be in
// in {disk_name}|{real_name} format
protected static function get_images_for_export($row, $base_path = 'images', &$images_to_export = null)
{
if (empty($row['images']))
return $row;
$image_paths = explode("\n", $row['images']);
$row['images'] = array();
foreach ($image_paths as $image_path)
{
list($disk_name, $file_name) = explode('|', $image_path, 2);
$new_name = preg_replace('/[^\w_\.-]+/u', '_', $row['sku'].'-'.$file_name);
$row['images'][] = $base_path.'/'.$new_name;
$images_to_export[$disk_name] = $new_name;
}
$row['images'] = join(",", $row['images']);
return $row;
}
線158是:
list($disk_name, $file_name) = explode('|', $image_path, 2);