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
{
}