【发布时间】:2016-10-05 10:02:47
【问题描述】:
所以我的代码如下所示:
$sql = "INSERT INTO users (email, password) VALUES (:email, :password)";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':email', $_POST['email']);
$stmt->bindParam(':password', sha1($_POST['password']));
if( $stmt->execute() ):
$message = 'Successfully created new user';
else:
$message = 'Sorry there must have been an issue creating your account';
endif;
错误是由这行引起的:
$stmt->bindParam(':password', sha1($_POST['password']));
希望有人可以帮助我删除“严格标准:仅应通过引用传递变量”错误。因为它仍在执行一切。
【问题讨论】:
-
$pass =sha1($_POST['password']); $stmt->bindParam(':password', $pass);
-
是的,最好在传递给另一个函数参数之前格式化你的变量。
标签: php