我在用戶註冊進入登錄頁面後有註冊頁面,當我們點擊用戶名i時,我想在頁面頂部顯示用戶名想下拉註銷在註銷用戶點擊shuold被註銷以後。登錄後在codeigniter頁面頂部顯示客戶名字
here is my controller code:
public function login()
{
$data['error'] ="Invalid Login";
$this->load->view('auth/header');
if($this->input->post())
{
$user = $this->UserModel->login($this->input->post());
if(count($user)>0)
{
$array = array(
'client_id' => $user['client_id'],
'first_name' => $user['first_name'],
'client_type_id'=>$user['client_type_id'],
'email' => $user['email'],
'password' => $user['password'],
);
$this->session->set_userdata('userdata',$array);
if($user['client_id'] == $user['client_id'])
{
redirect(base_url('dashboard/dashboard'));
}
}
else
{
$data["error_message"]="Invalid User Name and Password combination";
}
註銷
function logout()
{
$this->session->unset_userdata(userdata);
$this->session->sess_destroy();
redirect('Auth/login','refresh');
}
觀點:
<a href="javascript:;" data-toggle="dropdown" class="right_color">
<?php
echo $this->session->userdata('userdata');
?>
<!-- <img src="<?php echo base_url();?>images/admin.jpg" alt="admin-pic">-->
</a>
我在頭頁數組中遇到了一個錯誤字符串對話 – user3663
學習[基本調試](http://www.phpknow how.com/basics/basic-debugging/)在PHP中 – Viral
確定你能告訴我爲什麼會出現這個錯誤 – user3663