使用前必须先继承Controller
class Address extends Controller { protected $beforeActionList = [ //执行second,third之前先执行first 执行third之前先执行first,second 'first' => ['only' => 'second,third'] ]; //API接口的前置方法 执行顺序 i=1 public function first() { echo 'first'; } //API接口 i=2 public function second() { echo 'second'; } //i=3 public function third(){ echo 'third'; }