1

我正在尝试将 $users_in_range 数组中的用户 ID 内爆,问题是它是 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 />";
}
?>
4

2 回答 2

4

userid 是数组的键,所以你需要这样做:

$comma_separated = implode(",", array_keys($users_in_range));
于 2009-07-25T07:45:44.963 回答
1

尝试 :

$comma_separated = implode(',', array_keys($users_in_range));
于 2009-07-25T07:47:16.567 回答