我是php的新手,并且正在用php后端构建简单的android应用程序。 这是我的剧本。我正在使用android Volley库来调用此脚本,但这没有显示任何内容。任何帮助表示赞赏
<?php
require("config.php");
if (!empty($_POST)) {
$query = "SELECT company_name,info1,date,hour FROM customer WHERE phone_number = :phone_number ORDER BY id";
$query_params = array (':phone_number' => $_POST['phone_number']);
try {
$stmt = $db->prepare($query);
$result = $stmt->execute($query_params);
}
catch (PDOException $ex) {
$response["error"] = true;
$response["message"] = "Database Error1. Please Try Again!";
die(json_encode($response));
}
$pnumber = $_POST['phone_number'];
$row = $stmt->fetchAll();
if ($row == true)
{
$response = $row;
echo die(json_encode($response,JSON_UNESCAPED_UNICODE));
}
else {
$response["phone_number"] = "찾을 수 없음";
$response["company_name"] = "찾을 수 없음";
$response["info1"] = "찾을 수 없음";
$response["date"] = "찾을 수 없음";
$response["hour"] = "찾을 수 없음";
die(json_encode(array($response, JSON_UNESCAPED_UNICODE)));
}
}
?>
对不起,我的英语不好