我试图让下面的函数返回一个user_ids数组。这是php中的函数。
function users_following($follower_id)
{
include "dbconn.php";
$stmt = mysqli_prepare($con, "SELECT user_id FROM follo WHERE follower_id = ?");
mysqli_stmt_bind_param($stmt, "i", $follower_id);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $following_user_id);
$count = 0;
$user_array = array();
while (mysqli_stmt_fetch($stmt) ) {
$user_array[] = $following_user_id;
$count = $count + 1;
}
mysqli_stmt_close($stmt);
if ($count > 0)
{
return $user_array;
} else {
return false;
}
}
问题是上面的函数只返回输出:'数组' (没有引号),当我使用下面的代码测试时,而不是user_ids列表。
$userid_array = users_following($_SESSION["user_id"]);
echo $userid_array;
任何人都可以帮帮我吗?如果您需要其他详细信息,请在下面进行评论,我将尝试澄清。