编程语言
首页 > 编程语言> > ThinkPHP5简单的二级导航分类

ThinkPHP5简单的二级导航分类

作者:互联网

<?php
namespace app\index\controller;
use think\Controller;
class Common extends Controller
{
    public function __construct(){
	parent::__construct();
	$tptc = db('nav')->where("tid = 0")->order('sort ASC')->select();
        $tpts = db('nav')->where("tid != 0")->order('sort ASC')->select();
	$this->assign(array('tptc' => $tptc, 'tpts' => $tpts));
    }
}
{volist name="tptc" id="vo" key="k"}
	<li>
	{$vo.name}
		<dl>
		{volist name="tpts" id="vs" key="k"}
		{if condition ="$vo.id eq $vs['tid']"}
		<dd>{$vs.name}</dd>
		{/if}
		{/volist}
		</dl>
	</li>
{/volist}

标签:vs,name,tpts,分类,ThinkPHP5,vo,volist,tptc,导航
来源: https://blog.csdn.net/m0_37412958/article/details/78442086