扩展了 CotrollerBase 以及 phalcon 中的其他控制器,我想在 SmsSentController 中


extends CotrollerBase along with other controller in phalcon, I want to use the functions of postSmsController in SmsSentController

class ControllerBase
{
}

class postSmsController extends ControllerBase
{
}
class SmsSentController extends ControllerBase
{
}

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

您可以从另一个扩展一个

// 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
{
}
相关文章:
  • 没有找到相关文章