thinkphp5 初始化灵活方法
Genius 发布于 阅读:1322
<?php
namespace app\test\controller;
use think\Controller;
class YangZheWei extends Controller
{
protected $beforeActionList = [
'than',
'first' => ['except' => 'one'], //one 方法不可用
'san' => ['only' => 'three,two'], //只能three和two
];
protected function first()
{
echo '初始111<br>';
}
protected function than()
{
echo '初始222<br>';
}
protected function san()
{
echo '初始333<br>';
}
public function one()
{
return '111<br>';
}
public function two()
{
return '222<br>';
}
public function three()
{
return '333<br>';
}
}
?>