Codeigniter Tank Auth激活和注销错误

时间:2012-12-13 21:12:52

标签: php codeigniter tankauth

我已经开始在我的CodeIgniter应用程序中使用Tank Auth,我已经按照一些教程步骤进行设置,只要它有效,它会在帐户激活和注销期间产生大量错误消息。以下是错误:

A PHP Error was encountered

Severity: Notice

Message: Undefined index: session_id

Filename: libraries/Session.php

Line Number: 272

A PHP Error was encountered

Severity: Notice

Message: Undefined index: ip_address

Filename: libraries/Session.php

Line Number: 272

A PHP Error was encountered

Severity: Notice

Message: Undefined index: user_agent

Filename: libraries/Session.php

Line Number: 272

A PHP Error was encountered

Severity: Notice

Message: Undefined index: last_activity

Filename: libraries/Session.php

Line Number: 272

A PHP Error was encountered

Severity: Notice

Message: Undefined index: session_id

Filename: libraries/Session.php

Line Number: 288

A PHP Error was encountered

Severity: Notice

Message: Undefined index: last_activity

Filename: libraries/Session.php

Line Number: 289

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /projekt/system/core/Exceptions.php:185)

Filename: libraries/Session.php

Line Number: 675

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /projekt/system/core/Exceptions.php:185)

Filename: helpers/url_helper.php

Line Number: 542

以下是参考点的代码:

    foreach (array('session_id','ip_address','user_agent','last_activity') as $val)
    {
        unset($custom_userdata[$val]);
        $cookie_userdata[$val] = $this->userdata[$val]; //272 line
    }

    $this->CI->db->where('session_id', $this->userdata['session_id']); //288 line
    $this->CI->db->update($this->sess_table_name, array('last_activity' => //289 line $this->userdata['last_activity'], 'user_data' => $custom_userdata));
  setcookie( // 675 line
              $this->sess_cookie_name,
              $cookie_data,
              $expire,
              $this->cookie_path,
              $this->cookie_domain,
              $this->cookie_secure
          );

1 个答案:

答案 0 :(得分:1)

看起来这些错误并不严重,因为它们仍然只在错误层次结构的通知级别上。我会看一下代码点火器的源代码,看看是什么。源代码值得了解如何编辑和导航,因为它将节省时间。由于我没有使用Tank Auth,我不确定究竟是什么问题。我建议在源代码中设置var_dump语句来跟踪它发生了什么。看起来你的库或你正在使用的其他第三方工具中不存在模型或会话变量。您可能需要声明codeigniter的实例,以便使用这些第三方工具,因为它们存在于codeigniter范围之外。

$_CI =& get_instance(); // creates a CI instance that can exist outside of the MVC setup

您可以在本教程的“使用库中的CodeIgniter资源”部分中查看更多内容 http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html