Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP注意:未定义的偏移量:4_Php - Fatal编程技术网

PHP注意:未定义的偏移量:4

PHP注意:未定义的偏移量:4,php,Php,我得到以下错误 PHP注意:未定义的偏移量:4——第190行 在下面的代码块中。我在这里找到了两种不同的解决方案,包括isset,但似乎都不起作用 有人有什么建议吗 // If we don't have any data get it from the db $GLOBALS['AKB_CLASS_HELPER']->getCatsInfo(); $parentid = 0; if (!empty($arrCats[0])) { foreach ($arrCa

我得到以下错误

PHP注意:未定义的偏移量:4——第190行

在下面的代码块中。我在这里找到了两种不同的解决方案,包括isset,但似乎都不起作用

有人有什么建议吗

// If we don't have any data get it from the db

$GLOBALS['AKB_CLASS_HELPER']->getCatsInfo();
$parentid = 0;

if (!empty($arrCats[0])) {
            foreach ($arrCats as $cat) {
                foreach ($GLOBALS['AKB_CLASS_HELPER']->tree->nodesByPid[$parentid] as $catid) {  <--------- LINE190
                    $pcat = $GLOBALS['AKB_CLASS_HELPER']->catsById[$catid];
                    if (strtolower($pcat['name']) == strtolower($cat)) {
                        $GLOBALS['CatTrails'][] = array ($pcat['categoryid'], $cat);
                        $this->_catId = $pcat['categoryid'];
                        $parentid = $pcat['categoryid'];
                        break;
                    }
                }
            }
        }
//如果没有任何数据,请从数据库中获取
$GLOBALS['AKB_CLASS_HELPER']->getCatsInfo();
$parentid=0;
如果(!empty($arrCats[0])){
foreach($arrCats作为$cat){
foreach($GLOBALS['AKB_CLASS_HELPER']->tree->nodesByPid[$parentid]作为$catid){catsById[$catid];
if(strtolower($pcat['name'])==strtolower($cat)){
$GLOBALS['CatTrails'][]=数组($pcat['categoryid',$cat);
$this->_catId=$pcat['categoryid';
$parentid=$pcat['categoryid'];
打破
}
}
}
}

是否可以遍历$GLOBALS['AKB\u CLASS\u HELPER']->tree->nodesByPid[$parentid]节点?请检查
$parentid
的值是否设置正确。$parentid=4,并且这不是您正在窥探的数组中定义的偏移量。我编辑了我的原始帖子以显示上面的$parentid