多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 组件复用 >[info] moduleName| > controller/Widget.php > view/widget/toptoolbar.html 如图,只显示一个按钮工具条 ![](https://box.kancloud.cn/1b51bbc7a6b2791dffaeaf5c0b6ee4fb_646x309.png) >[info] widget.php ``` <?php namespace app\chsys\widget; use app\common\builder\ZBuilder; use think\Controller; // use app\user\model\User as UserM; use app\chsys\model\Customer as CustomerM; use app\chsys\model\Equipment as EquipmentM; use app\chsys\model\Equipmentlog as EquipmentlogM; // use util\Tree; // use think\Db; // use think\Cache; /** * 检索 * @package app\chsys\admin * */ class Widget extends Controller { /** * 搜索工具条 * @return void */ public function toptoolbar() { return $this->fetch('/widget/toptoolbar'); } } ``` >[info] toptoolbar.html ``` <div class="bg-gray-light border-b"> <ul class="js-media-filter nav nav-pills push"> <li class="active"> <a class='pop' href="{:url('iplist/getUserip',['_pop'=>1])}" data-category="all"> <i class="fa fa-fw fa-folder-open-o push-5-r"></i> 申请IP地址</a> </li> </ul> </div> ``` >[info] 控制器中加载代码 ``` ........ $toolHtml = widget('Widget/toptoolbar'); $this->assign('TOOLSDIV',$toolHtml); return $this->fetch(); ```