亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

auth報錯

按老師課程編寫執行之后,報一個錯誤,百思不得其解,請求指點http://img1.sycdn.imooc.com//56e913e30001a3d007480232.jpg

附上authModel.class.php代碼:

<?php

class authModel{

private $auth = '';


public function __construct(){

//判斷當前是否已經登錄

if($_SESSION['auth']&&(!empty($_SESSION['auth']))){

$this -> auth = $_SESSION['auth'];

}

}





//定義登錄驗證的方法

public function loginsubmit(){

if(empty($_POST['username'])||empty($_POST['password'])){

return false;

}

$username = daddslashes($_POST['username']);

$password = daddslashes($_POST['password']);

if($this->auth = $this->checkuser($username,$password)){

$_SESSION['auth'] = $this->auth;

return true;

}else{

return false;

}


}




public function checkuser($username,$password){

$auth = M('admin')->findOne_by_username($username);

if($auth&&$password == $auth['password']){

return $auth;

}else{

return false;

}

}


public function getAuth(){

return $this->auth;

}



}


?>


正在回答

2 回答

已經排查解決,if($_SESSION['auth']&&(!empty($_SESSION['auth'])))改成if(isset($_SESSION['auth'])&&(!empty($_SESSION['auth'])))后解決了

0 回復 有任何疑惑可以回復我~

這個應該是提醒,不算真正的錯誤,可以加@屏蔽掉

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
MVC架構模式分析與設計
  • 參與學習       82428    人
  • 解答問題       954    個

通過學習MVC理論知識,由淺入深帶您實現人生第一個MVC框架

進入課程
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號