From f9b895732e83903b601dd6ca4852408e845cb6dd Mon Sep 17 00:00:00 2001 From: ouzhiqiang <835402500@qq.com> Date: Thu, 18 Sep 2025 17:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/controller/TopicNas.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/index/controller/TopicNas.php b/app/index/controller/TopicNas.php index ebf598d4..884b49b7 100644 --- a/app/index/controller/TopicNas.php +++ b/app/index/controller/TopicNas.php @@ -268,20 +268,20 @@ class TopicNas extends Common $article_categorys_new = []; $article_categorys_two = []; if (!$article_categorys->isEmpty()) { - foreach ($article_categorys as $kk=>$vv) { - if ( $parent == $vv->pid ) { + foreach ($article_categorys->toArray() as $kk=>$vv) { + if ( $parent == $vv['pid'] ) { array_push($article_categorys_new,$vv); } else { - $article_categorys_two[$vv->pid][] = $vv; + $article_categorys_two[$vv['pid']][] = $vv; } } if ( !empty($article_categorys_two) ) { foreach ($article_categorys_new as &$vvv) { - $vvv['child'] = isset($article_categorys_two[$vvv->id])?$article_categorys_two[$vvv->id]:''; + $vvv['child'] = isset($article_categorys_two[$vvv['id']])?$article_categorys_two[$vvv['id']]:''; } } } - dump($article_categorys_new->toArray());exit; + dump($article_categorys_new);exit; // dump($article_categorys_two);exit; View::assign('article_categorys', $article_categorys_new);