所有人
我正在使用user.php代码。显示此错误:
注意:只有变量应该在第19行通过引用传递
请检查以下代码,让我知道我所缺少的内容。我将非常感谢,
<?php
class user {
protected $pdo;
function __construct($pdo){
$this->pdo = $pdo;
}
public function checkInput($var){
$var = htmlspecialchars($var);
$var = trim($var);
$var = stripcslashes($var);
return $var;
}
public function login($email, $password){
$stmt = $this->pdo->prepare("SELECT `user_id` FROM `users` WHERE `email` = :email AND `password` = :password");
$stmt->bindParam(":email", $email, PDO::PARAM_STR);
$stmt->bindParam(":password", md5($password), PDO::PARAM_STR);
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_OBJ);
$count = $stmt->rowCount();
if($count > 0){
$_SESSION['user_id'] = $user->user_id;
header('Location: home.php');
}else{
return false;
}
}
}
谢谢!