我试图破坏$ users_in_range数组中的userIDs问题是它是iploding里程而不是用户ID
<?PHP
$users_in_range = users_in_range($lat, $long, 500, true);
// implode users into mysql friendly list
$comma_separated = implode(",", $users_in_range);
echo $comma_separated;
// this is just for output while debugging
foreach ($users_in_range as $userid => $miles_away) {
echo "UserID=<b>$userid</b> is <b>$miles_away</b> miles away from me.<br />";
}
?>
答案 0 :(得分:4)
userid是数组的键,因此您需要执行以下操作:
$comma_separated = implode(",", array_keys($users_in_range));
答案 1 :(得分:1)
尝试:
$comma_separated = implode(',', array_keys($users_in_range));