看网上说的 使用前置操作beforeActionList,但是不知道怎么用,所有的api接口 控制器之前都验证token 应该放在哪儿?
namespace appindexcontroller;
class Index extends hinkController
{
protected $beforeActionList = [
'checkToken',
];
protected function checkToken()
{
echo 'checkToken<br/>';
}
public function index()
{
echo '测试';die();
}
}
上边的index控制器里的beforeActionList 和checkToken()应该放在什么地方 如何在所有控制器调用?给个例子吧 初次接触 没闹明白 用的thinkphp5 多谢