Php 科哈纳3-构造器

Php 科哈纳3-构造器,php,authentication,constructor,kohana-3,Php,Authentication,Constructor,Kohana 3,我试图使用public function\uuu construct(){},但出现了错误 ErrorException[严格]:正在创建 默认对象从空值开始 这背后的原因是我使用的控制器仅对登录用户受保护,我不想调用$this->protect()来自控制器中的每个操作 因此,我尝试使用调用$this->protect()的构造函数在before()方法中使用您登录的安全保护措施。方法 public function before() { parent::before(); $

我试图使用
public function\uuu construct(){}
,但出现了错误

ErrorException[严格]:正在创建 默认对象从空值开始

这背后的原因是我使用的控制器仅对登录用户受保护,我不想调用
$this->protect()来自控制器中的每个操作


因此,我尝试使用调用
$this->protect()的构造函数

before()方法中使用您登录的安全保护措施。
方法

public function before() {
    parent::before();
    $this->protect();

}