未定义的偏移量:6

时间:2014-10-10 17:24:05

标签: php

这是导致偏移的代码,我找不到原因。

 {
    /* menu set up */
    $arData = file($this->_sMenuFile);
    $index = 0;
    foreach($arData as $line) {
        //On this line is where the error is happening.                                                        
        list($level,$group,$label,$module,$file,$order,$width) = explode('|',trim($line));
        if($level == "top") $sGroup = $label;
        if(strlen($file) > 0) {
        $this->_arMenuItems['name'][$index] = $label;
        $this->_arMenuItems['group'][$index] = $sGroup;
        $this->_arMenuItems['module'][$index] = $module;
        $this->_arMenuItems['file'][$index] = $file;
        $index++;
    }
}

1 个答案:

答案 0 :(得分:0)

使用此

  if($level == "top") $sGroup = $label;
  if(strlen($file)-1 > 0) {
    $this->_arMenuItems['name'][$index] = $label;
    $this->_arMenuItems['group'][$index] = $sGroup;
    $this->_arMenuItems['module'][$index] = $module;
    $this->_arMenuItems['file'][$index] = $file;
    $index++;
                        }
}