0
class ControllerBase
{

}


class postSmsController extends ControllerBase
{

}

class SmsSentController extends ControllerBase
{

}

如何在 phalcon 中扩展 CotrollerBase 和其他控制器,我想在 SmsSentController 中使用 postSmsController 的功能,也想在两个 Controller 类中使用 ControllerBase 的功能。我应该怎么办

4

1 回答 1

0

You can extend one from another

// Base controller
class ControllerBase
{
    public function one()
    {

    }
}


// Extending. Offers one() and two()
class postSmsController extends ControllerBase
{
    public function two()
    {

    }
}

// Extending. Offers one() and two() and three()
class SmsSentController extends postSmsController
{
    public function three()
    {

    }
}

// Offers only one()
class otherController extends ControllerBase
{

}
于 2013-07-11T13:26:30.813 回答