public function login($username,$password)
{
$thid->newUser = $this->conn->$this->query("SELECT COUNT(id) FROM user WHERE username = :username and password = :password",
array(':username' => $username,
':password' => $password
));
}
我想使用正确的用户名和密码登录。
if($_SERVER['REQUEST_METHOD'] == "POST") {
$username = $_POST['username'];
$password = $_POST['password'];
if(empty($username) || empty($password)) {
$data = array('status' => 'Please enter your Username and Password');
} else {
$login = $user->login($username,$password);
$count = $login->fetchColumn();
if($count == 1) {
$user->redirectURL('home.php');
} else {
$data = array('status' => 'Wrong Username or Password');
}
}
} else {
$data = '';
}
它说:可捕获的致命错误:类的对象在执行时无法转换为字符串。