【发布时间】:2015-12-15 08:44:58
【问题描述】:
Postman is an IDE for making APIs in Chrome.
我将路线定义为:
PHP case 语句中的逻辑为:
case "checkContactsWithServer":
if ($userId = authenticateUser($db, $username, $password, $gcmregid))
{
$phoneNumCSV = $_REQUEST['phone_num_csv'];
$syncContactsServerSQL = "SELECT DISTINCT
source_user_sync_id, target_user_sync_id, friend_request_sync_id, status, user_sync_id, phone_number
FROM friends a
RIGHT JOIN (SELECT distinct
user_sync_id,
phone_number
FROM users
WHERE phone_number IN ('".$phoneNumCSV."')
AND user_sync_id != '".$userId."'
) b
ON a.target_user_sync_id = '".$userId."'
AND a.source_user_sync_id = b.user_sync_id
OR a.source_user_sync_id = '".$userId."'
AND a.target_user_sync_id = b.user_sync_id;";
if($result = $db->query($syncContactsServerSQL))
{
$rows = array();
while($row = $result->fetch_assoc()){
$rows[] = array('data' => $row);
}
// now all the rows have been fetched, it can be encoded
echo json_encode($rows);
}
else
{
$out = FAILED;
}
}
else
{
error_log($out, 0);
$out = FAILED;
}
break;
如上所示,将两个电话号码作为 CSV 传递,即。 "number1,number2",JSON 结果只有一个对象。但是在数据库中运行查询,返回两个,因为它应该:
我知道我在这里遗漏了一些简单的东西。我该如何配置它才能工作?
【问题讨论】:
-
我不得不反向搜索你的截图,只是为了弄清楚这是什么叫做“邮递员”的东西。您的整个问题都没有提到您寻求帮助的软件的名称。祝你好运..
-
使用邮递员只是允许将有组织的请求发送到您的服务器进行测试,没什么特别的
-
好吧,那么标记 SQL.. 对我来说似乎是一个 sql 问题
-
你的 php 代码已经成熟,可以进行 SQL 注入了。