Php 保存寄存器数据时出现严格标准错误

Php 保存寄存器数据时出现严格标准错误,php,sql,pdo,Php,Sql,Pdo,我正在学习一个创建注册和登录系统的教程。我做的一切都是一样的,但当我在表单上按submit时,仍然会出现一个奇怪的严格标准错误 <?php require 'pdoconnect.php'; $message = ''; if(!empty($_POST['email']) && !empty($_POST['password'])): // Enter the new user in the database $sql = "INSERT INTO users

我正在学习一个创建注册和登录系统的教程。我做的一切都是一样的,但当我在表单上按submit时,仍然会出现一个奇怪的严格标准错误

<?php

require 'pdoconnect.php';

$message = '';

if(!empty($_POST['email']) && !empty($_POST['password'])):


// Enter the new user in the database
$sql = "INSERT INTO users (email, password) VALUES (:email, :password)";
$stmt = $conn->prepare($sql);

$stmt->bindParam(':email', $_POST['email']);
$stmt->bindParam(':password', password_hash($_POST['password'], PASSWORD_BCRYPT));

if( $stmt->execute() ):
    $message = 'Successfully created new user';
else:
    $message = 'Sorry there must have been an issue creating your account';
endif;

endif;

?>

上面说

严格标准:第14行(带有密码散列的行)上的引用只能传递变量

我到处都在寻找解决办法,但我找不到任何办法

在绑定密码之前对其进行哈希运算:

// Enter the new user in the database
$sql = "INSERT INTO users (email, password) VALUES (:email, :password)";
$stmt = $conn->prepare($sql);

$hashedPass = password_hash($_POST['password'], PASSWORD_BCRYPT);
$stmt->bindParam(':email', $_POST['email']);
$stmt->bindParam(':password', $hashedPass );

不能将函数传递给绑定参数,只能传递变量。

bindParam()中使用哈希之前,应先对密码进行哈希运算。
谢谢!密码现在安全地散列在数据库中:)好吧。。。看看你,花式裤子先生。现在我们不得不称你为“热裤先生”山姆。吉奇你的热裤对吧,欢呼@JayBlanchard,嗯,山姆?lmho