【发布时间】:2017-03-08 19:36:47
【问题描述】:
我正在使用教程为博客创建管理员登录。当我单击按钮登录时出现此错误:
致命错误:在第 50 行调用 D:\XAMPP\htdocs\ICT PRoject\class.user.php 中未定义的方法 User::password_verify()
我查看了另一个已回答的问题,该问题说 password_verify() 函数仅从 php 5.0 开始包含。但是,我检查了一下,我的版本是 php 5.6.8。我没有任何其他想法,因此非常感谢您的帮助! 这是错误来自的函数的代码:
public function login($username,$password){
$hashed = $this->get_user_hash($username);
if($this->password_verify($password,$hashed) == 1){
$_SESSION['loggedin'] = true;
return true;
}
}
【问题讨论】:
-
把这个
if($this->password_verify($password,$hashed) == 1){改成if(password_verify($password,$hashed)){ -
并确保您了解
$this的含义。 -
谁对这个问题和所有答案投了反对票而没有任何解释?
标签: php login fatal-error