2017-07-31 146 views
2

严重性:4096对象无法转换为字符串

消息:类Login_Model的对象不能被转换成字符串

文件名:型号/ login_model.php

线号码:27

public function login() { 
    //check user type 

    $this->_table_name = 'tbl_employee_login'; 
    $this->_order_by = 'employee_login_id'; 
    $employee = $this->get_by(array(
     'email' => $this->input->post('email'), 
     'password' => $this->$this->input->post('password'), LINE NUMBER 27 
     'activate' => 1 
    ), TRUE); 
    /*employee*/ 
    $this->_table_name = 'driver'; 
    $this->_order_by = 'driver_id'; 

    $driver = $this->get_by(array(
     'email' => $this->input->post('email'), 
     'password' => $this->$this->input->post('password'), 
    ), TRUE); 
    /*driver*/ 
    $this->_table_name = 'tbl_user'; 
    $this->_order_by = 'user_id'; 

    $admin = $this->get_by(array(
     'email' => $this->input->post('email'), 
     'password' => $this->$this->input->post('password'), 
      ), TRUE); 
    if ($admin) { 
     $data = array(
      'email' => $admin->email, 
      'first_name' => $admin->first_name, 
      'last_name' => $admin->last_name, 
      'employee_id' => $admin->user_id, 
      'loggedin' => TRUE, 
      'user_type' => 1, 
      'user_flag' => $admin->flag, 
      'url' => 'admin/dashboard', 
     ); 
     $this->session->set_userdata($data); 
    } elseif($employee) { 

     if (count($employee)) { 
      // Log in user 
      $employee_id = $employee->employee_id; 
      $this->_table_name = "tbl_employee"; //table name 
      $this->_order_by = "employee_id"; 
      $user_info = $this->get_by(array('employee_id' => $employee_id), TRUE); 

      $data = array(
       'email' => $employee->email, 
       'employee_id' => $employee->employee_id, 
       'user_name' => $user_info->first_name . ' ' . $user_info->last_name, 
       'employee_login_id' => $employee->employee_login_id, 
       'loggedin' => TRUE, 
       'user_type' => 2, 
       'url' => 'employee/dashboard', 
      ); 
      $this->session->set_userdata($data); 
     } 
    } 
    elseif($driver){ 
     $data = array(
      'email' => $driver->email, 
      'drive_id' => $driver->driver_id, 
      'name' => $driver->name, 
      'loggedin' => TRUE, 
      'user_type' => 3, 
      'url' => 'driver/dashboard', 
     ); 
     $this->session->set_userdata($data); 
    } 
} 

任何一个可以给我一个解决这个错误的解决方案。我尝试使用管理员用户名和密码登录,但它告诉我这一点,更像是一串误差转换

+0

您可以发布您全班......你刚刚发布的功能..所以,我可以找到行号27 – Farsay

+0

@Farsay,'“密码” => $此 - > $这个 - >输入 - >后('password'),LINE NUMBER 27' –

+0

为什么你有'$ this - > $ this'? – Barmar

回答

2

typo$this

'password' => $this->$this->input->post('password'), 

更改为

'password' =>$this->input->post('password'), 

注:而且same mistake在很多other lines也太在意了。

+0

谢谢@JYoThI –

+0

是的,我会在网站给我5分钟后的权限后标记 –

+0

酷:)很高兴帮助你:) – JYoThI

1

它应该是$这个 - >输入 - >后(“密码”)

1

你有键入错误是$这个 - > $这在3个地方在你的代码。