单动作控制器
如果你想要定义一个只处理一个动作类,可以在这个类中定义 __invoke
方法:
<?php class ShowProfile { /** * Show the profile for the given user. * * @param int $id * @return Response */ public function __invoke($id) { echo $id } }
$a = new ShowProfile();
$a(5);
5
如果你想要定义一个只处理一个动作类,可以在这个类中定义 __invoke
方法:
<?php class ShowProfile { /** * Show the profile for the given user. * * @param int $id * @return Response */ public function __invoke($id) { echo $id } }
$a = new ShowProfile();
$a(5);
5