使用php检索stdClass对象中的标记

时间:2015-05-17 14:23:40

标签: php instagram stdclass

我正在尝试使用此代码检索RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 标记。但它没有用。

- instagram返回:

[followed_by]

我的PHP代码:

 stdClass Object
(
  [meta] => stdClass Object
    (
        [code] => 200
    )

[data] => stdClass Object
    (
        [username] => kenzasmg
        [bio] => Based in Paris | Twitter : @KenzaSMG | Facebook : La Revue de Kenza | Snapchat 👻 : KenzaSMG | kenzasmg@gmail.com
        [website] => http://larevuedekenza.fr/
        [profile_picture] => https://instagramimages-a.akamaihd.net/profiles/profile_3169582_75sq_1365288071.jpg
        [full_name] => Kenza  Sadoun - El Glaoui
        [counts] => stdClass Object
            (
                [media] => 5144
                [followed_by] => 76722
                [follows] => 250
            )

        [id] => 3169582
    )

)

1 个答案:

答案 0 :(得分:0)

foreach ($result->data as $data)

给你[用户名],[生物] ...... [计数] ..所以,你不能问data->counts->followed_by; 试试这样:

$followed = $result->data->counts->followed_by;