Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Kohana--用户注册运行时错误(auth)_Php_Jquery_Ajax_Authentication_Kohana - Fatal编程技术网

Php Kohana--用户注册运行时错误(auth)

Php Kohana--用户注册运行时错误(auth),php,jquery,ajax,authentication,kohana,Php,Jquery,Ajax,Authentication,Kohana,我正在Kohana中实现auth模块,但我似乎无法找出此错误消息的来源——当我提交在数据库中创建用户的注册表单时(它成功地做到了这一点) 检测到错误,导致无法加载此页面。如果此问题仍然存在,请与网站管理员联系 application/controllers/register.php[83]: 未定义的属性:寄存器\控制器::$auth 我正在使用jquery来验证表单,在添加jquery之前表单工作得很好,所以问题可能与ajax请求有关,但我不确定从那里开始 以下是堆栈跟踪: *

我正在Kohana中实现auth模块,但我似乎无法找出此错误消息的来源——当我提交在数据库中创建用户的注册表单时(它成功地做到了这一点)

检测到错误,导致无法加载此页面。如果此问题仍然存在,请与网站管理员联系

application/controllers/register.php[83]:

未定义的属性:寄存器\控制器::$auth

我正在使用jquery来验证表单,在添加jquery之前表单工作得很好,所以问题可能与ajax请求有关,但我不确定从那里开始

以下是堆栈跟踪:

   *

     Register_Controller->create_user(  )

   * system/core/Kohana.php [291]:

     ReflectionMethod->invokeArgs( Register_Controller Object
     (
         [template] => View Object
             (
                 [kohana_filename:protected] => /var/www/ko/testsite/system/views/form/template.php
                 [kohana_filetype:protected] => .php
                 [kohana_local_data:protected] => Array
                     (
                     )

             )

         [auto_render] => 1
         [uri] => URI Object
             (
             )

         [input] => Input Object
             (
                 [use_xss_clean:protected] => 1
                 [magic_quotes_gpc:protected] => 1
                 [ip_address] => 
             )

     )
      )

   *

     Kohana::instance(  )

   * system/core/Event.php [209]:

     call_user_func( Array
     (
         [0] => Kohana
         [1] => instance
     )
      )

   * system/core/Bootstrap.php [55]:

     Event::run( system.execute )

   * index.php [106]:

     require( system/core/Bootstrap.php )
下面是Register\u控制器中的create\u user()方法:

public function create_user()
{
   if($_POST)
   {
      $post = $this->input->post();
      $user = ORM::factory('user');

      $user->add(ORM::factory('role', 'login'));

     if($user->validate($post, TRUE))
      {
         $this->auth->login($user, $post->password);
         url::redirect();
      }
      else
      {
         url::redirect('register');
      }
   }
}

有人有什么建议吗P

您得到的错误是因为控制器中不存在变量$this->auth

我猜你是想做
$this->auth=auth::instance()在构造函数中。

非常感谢——出于某种原因,我认为我已经包含了它