我正在尝试将 $users_in_range 数组中的用户 ID 内爆,问题是它是内爆英里而不是用户 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 />";
}
?>
userid 是数组的键,所以你需要这样做:
$comma_separated = implode(",", array_keys($users_in_range));
尝试:
$comma_separated = implode(',', array_keys($users_in_range));