1.在App\index\controller 里面自定义一个Base控制器
<?php
namespace app\index\controller;
use think\Controller;
class Base extends Controller
{
public function _initialize(){
echo '------------------basadfse--------------------';
}
}
2.调用该控制器
<?php
namespace app\index\controller;
class Test extends Base
{
public function index(){
echo '------------------testfsa--------------------';
}
}