//好友数量 $user_id = $user->id; $sql = "select count(*) as total from `user_friend` where `status` = ? and( ( `user_id` = {$user_id} ) or ( `friend_user_id` = {$user_id} ))"; $my_friend = DB::select($sql,[1]);