fetch data from an object

前端 未结 2 1645
粉色の甜心
粉色の甜心 2021-01-28 07:16

I am trying to fetch data from user\'s twitter account with this code

$user_info = $twitteroauth->get(\'account/verify_credentials\');

i get

2条回答
  •  无人及你
    2021-01-28 08:08

    You are trying to access a object with the array index syntax it will not work this way.

    When you are dealing with objects you need to access the array by using "->"

    $user_info->name;
    $user_info->entities->description;
    $user_info->entities->description->urls;
    

    This is the pattern to access to the depth

提交回复
热议问题