我的非對象電話部件數據對用戶數據()的非對象上
在得到錯誤
電話部件數據對用戶數據()當我設置
Session
$this->session->userdata('userName', $userName);
登錄控制器
<?php class loginController extends CI_Controller { function __construct() { parent::__construct(); $this->load->library('session'); } public function login() { $this->load->View("template/header"); $this->load->View("login_view"); } public function AuthenticateUser() { //Is the UserName and Password values retrieved? if(isset($_POST['userName']) && isset($_POST['password'])) { $this->load->library("UserFactory"); $userName = addslashes($_POST['userName']); $password = addslashes($_POST['password']); //Get User details based on UserName and Password $data = array( "users" => $this->userfactory->checkLogin($userName, $password) ); if($data["users"] != null) { $this->session->userdata('userName', $userName); } header('Content-Type: application/json'); echo json_encode($data["users"]); } } } ?>
任何想法爲什麼發生這種情況?
我不知道爲什麼* *但是我會想象會議對象我不會被分配到'$ this-> session'。我將首先檢查構造函數以查看會話的設置,看看是否能夠指出問題的原因。 – StuBez
正在使用'set_userdata()'將var分配給會話。 'userdata()'從會話中獲取var。 – sotoz
當我在構造函數中加載庫。它說:'ini_set():一個會話是活動的。您目前無法更改會話模塊的ini設置# – Pankaj