我有一个包含不同方法的 PHP 类:
namespace App\Controllers;
class SuperAdminController extends Controller {
public function name1Action($wanted = ''){
$o = new name1Controller();
self::routeWanted($wanted,$o,$this);
}
...
public function name10Action($wanted = ''){
$o = new name10Controller();
self::routeWanted($wanted,$o,$this);
}
private function routeWanted($wanted,$o,$that){
switch($wanted){
do something...
}
}
}
如何将我的所有公共功能分组为一个功能,例如
public function name1Action ... name10Action($wanted = ''){
$o = new name1Controller();
self::routeWanted($wanted,$o,$this);
}