添加菜单报错问题【急】

ITKEE反馈
收藏
1 136
Sunny912
JoshChen 钻石会员 2018-03-11 18:35:54
付费话题:0 积分

未定义数组索引: child

<div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
                <?php if(is_array($left_nav) || $left_nav instanceof \think\Collection || $left_nav instanceof \think\Paginator): if( count($left_nav)==0 ) : echo "" ;else: foreach($left_nav as $key=>$vo): ?>
                <ul class="layui-nav layui-nav-tree menu-left" id="menu-left-<?php echo $key; ?>">
                    <?php if(is_array($vo) || $vo instanceof \think\Collection || $vo instanceof \think\Paginator): if( count($vo)==0 ) : echo "" ;else: foreach($vo as $key=>$voo): ?>
                    <li class="layui-nav-item layui-nav-itemed">
                        <a class="" href="javascript:;"><i class="layui-icon">?</i>  <?php echo $voo['title']; ?></a>
                        <dl class="layui-nav-child">
                            <?php if(is_array($voo['child']) || $voo['child'] instanceof \think\Collection || $voo['child'] instanceof \think\Paginator): if( count($voo['child'])==0 ) : echo "" ;else: foreach($voo['child'] as $key=>$vooo): ?>
                            <dd><a class="<?php if(($key==0)): ?>open<?php endif; ?>" data-type="tabAdd" data-menu-id="1" data-herf="<?php echo url($vooo['name']); ?>"><?php echo $vooo['title']; ?></a></dd>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                        </dl>
                    </li>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                </ul>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </div>
        </div>


回帖
  • SuperMan
    2018-03-12 15:12:16

    该错误提示为遍历了一个空对象数据导致报错,可以调试查看一下!

    0 回复
0.038202s