利用閉包綁定:

1
2
3
4
5
6
7
$ctrlr = new UserController;
$tester = function () use ($uid) {
$this->getUser($uid);
};
$runner = $tester->bindTo($ctrlr, $ctrlr);
$runner();