我试图向服务器发送一串数字并拆分每个数字。如果数据库中存在数字,则分配“t”值,如果不存在,则分配“f”值。 但由于某种原因,我只得到t的。如何检查服务器上是否存在数据PHP
<?php
# get phone from uid
include_once 'utils.php';
$phone = $_GET['phone'] or die("isRegistered: missing phone");
$response = "";
$phonearray = explode(":", $phone);
for ($i = 0; $i<sizeof($phonearray); $i++){
$result = findRow("phone", $phonearray[i], "user_device") or "true" ;
if($result == "true")
{
$response = $response."t".":";
$result = "";
}
else
{
$response = $response."f".":";
$result = "";
}
}
die($response);
?>
您的if和else条件都将$ response设置为t。 –
对不起,这是一个错字。 – nishantvodoo