Authored by 郝肖肖

判断sub 变量 是否存在

@@ -92,6 +92,9 @@ class HomeModel @@ -92,6 +92,9 @@ class HomeModel
92 // 'subnav' => array() 92 // 'subnav' => array()
93 ); 93 );
94 $indexSub = 0; 94 $indexSub = 0;
  95 +
  96 + //判断sub变量是否存在
  97 + $val['sub'] = empty($val['sub']) ? array() : $val['sub'];
95 foreach ($val['sub'] as $sub) { // 二级 98 foreach ($val['sub'] as $sub) { // 二级
96 $subnav = array( 99 $subnav = array(
97 'name' => $sub['sort_name'], 100 'name' => $sub['sort_name'],