我正在
致命错误:第10行的语法错误
我不熟悉关联数组。我知道这是一个愚蠢的错误,但我无法弄清楚那是什么。
<?php
$conn = new mysqli('','','','');
if($conn->connect_error)die($conn->connect_error);
$response = array();
$email = $_POST['email'];
$password = $_POST['password'];
$encrypted_password = hash('ripemd160',$password);
$query1 = "SELECT password FROM users where email='$email'";
$result = $conn->query($query1);
$temp = $result->fetch_assoc()['password'];
if($encrypted_password == $temp)
{
$response["success"] = 1;
echo json_encode($response);
}
else
{
$response["success"] = 0;
echo json_encode($response);
}
$conn->close();
?>
答案 0 :(得分:1)
PHP
中的数组解除引用问题$temp = $result->fetch_assoc()
$temp = $temp['password'];
基于&#39; DarkBee &#39;和&#39; Elias Van Ootegem &#39;注释, PHP&gt; = 5.4
支持数组解除引用