我有一个连接到mysql数据库的PHP代码。我想从邮递员工具发送用户登录数据,并在php代码中接收它,然后将其返回到结果
问题在于,发送数据时未得到结果
PHP代码
<?php
$response = array();
header("Content-type: application/json; charset=utf-8");
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
include 'db/db_connect.php';
include 'functions.php';
//Get the input request parameters
$inputJSON = file_get_contents('php://input');
$input = json_decode($inputJSON, TRUE); //convert JSON into array
//Check for Mandatory parameters
if(isset($input['username']) && isset($input['password']) ){
$username = $input['username'];
$password = $input['password'];
$query = "SELECT full_name , password_hash , salt , email , id_con , born , city , country و card_id ,cardstatus, cardvalue FROM member WHERE username = ?";
if($stmt = $con->prepare($query)){
$stmt->bind_param("s",$username);
$stmt->execute();
$stmt->bind_result($fullName , $passwordHashDB ,$salt, $email , $countryid , $born , $city , $country ,$cardid ,$cardstatus, $cardvalue);
if($stmt->fetch()){
//Validate the password
if(password_verify(concatPasswordWithSalt($password,$salt),$passwordHashDB)){
$response["status"] = 0;
$response["message"] = "Login successful";
$response["full_name"] = $fullName;
$response["card_id"] = $cardid;
$response["email"] = $email;
$response["id_con"] = $countryid;
$response["country"] = $country;
$response["city"] = $city;
$response["born"] = $born;
$response["cardstatus"] = $cardstatus;
$response["cardvalue"] = $cardvalue;
}
else{
$response["status"] = 1;
$response["message"] = "Invalid username and password combination";
}
}
else{
$response["status"] = 1;
$response["message"] = "Invalid username and password combination";
}
$stmt->close();
}
}
else{
$response["status"] = 2;
$response["message"] = "Missing mandatory parameters";
}
//Display the JSON response
echo json_encode($response);
?>
SCREENSHOT