注意:未定义索引:活动

时间:2018-05-22 04:31:38

标签: php

我需要有人来看看这段代码:

public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = null)
 {
     parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $id_lang_shop);

     if ($this->_list) {
        foreach ($this->_list as &$row) {
            $row['badge_warning'] = $row['active'] < 1;
        }
     }
 }

问题与此行有关 $row['badge_warning'] = $row['active'] < 1;

  

注意:未定义索引:活动

1 个答案:

答案 0 :(得分:0)

使用isset函数检查“active”,

像这样,

foreach ($this->_list as &$row) {
        $row['badge_warning'] = isset($row['active'])?$row['active']:'' < 1;
    }