简体   繁体   English

PHP Facebook登录用户的自动关注系统

[英]Automatic follow system for PHP Facebook login user

I am trying to make a system that follow new user's Facebook friend automatically. 我正在尝试创建一个自动跟踪新用户的Facebook朋友的系统。

When a user log in to the website with their Facebook ID, the server store their Facebook id number into the db column. 当用户使用其Facebook ID登录到网站时,服务器会将其Facebook ID号存储在db列中。

Therefore, I would like to retrieve Facebook friend id numbers and match them to current signed user's Facebook ID numbers. 因此,我想检索Facebook朋友ID号并将其与当前签名用户的Facebook ID号进行匹配。

here is array data from Facebook friend. 这是来自Facebook朋友的数组数据。

Array (
    [data] => Array (
        [0] => Array (
            [name] => James1
            [id] => 1111
        )
        [1] => Array ( 
            [name] => James2
            [id] => 2222
        )
        [2] => Array (
            [name] => James3
            [id] => 3333
        )
        [3] => Array ( 
            [name] => James4
            [id] => 4444
        )
        [4] => Array ( 
            [name] => James5
            [id] => 5555
        ) [5] => Array ( 
            [name] => James6
            [id] => 6666
        )
    )
) 

I tried to use in_array PHP command, but didn't work. 我尝试使用in_array PHP命令,但是没有用。

Can you give me an idea how to make this? 你能给我个主意吗?

try: 尝试:

foreach($yourArr['data'] as $val) {
   if($yourUserId == $val["id"]) {
      ///found
      break;
   }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM