简体   繁体   English

Opencart 3.0.3.3 上的这段代码有什么问题

[英]What its wrong in this code on Opencart 3.0.3.3

Whats its wrong in this code?这段代码有什么问题?

// Begin LJK - option display names
if (strlen(trim($option['display'])) != 0){
$option['name'] = $option['display'];
}
// End LJK - option display names

I have This Error on cart!我在购物车上有这个错误! But module works fine但是模块工作正常

Notice: Undefined index: display in /home/opencart/public_html/storage/modification/catalog/controller/checkout/cart.php on line 101注意:未定义索引:显示在/home/opencart/public_html/storage/modification/catalog/controller/checkout/cart.php 101行

you should check if this display key exist in this array or not ( $option['display'] ) before use trim and strlen methods so you should change your code to be like this:-在使用 trim 和 strlen 方法之前,您应该检查此显示键是否存在于此数组中( $option['display'] ),因此您应该将代码更改为如下所示:-

if ( !empty($option['display']) && strlen(trim($option['display'] ) ) != 0 ) {
$option['name'] = $option['display'];
}

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

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