ba
<?php
namespace admin\controller;
use think\controller;
class base extends Controller
{
public function _initialize()
{
$indexModel=D('index');
$config=$indexModel->config();
$this->assign('config',$config);
$topnav=$indexModel->topbar_nav();
$this->assign('topnav',$topnav);
}
}index.php<?php
namespace admin\controller;
use think\controller;
class Index extends base
{
public function index()
{
echo $this-> fetch();
}
}Tips:用法和thinkphp3.2.3一样,只不过他自动生成的是默认不use think\controller的,记得加上就行。为啥不加,因为他的口号就是为了api模式,精简了 最佳答案