2017-10-19 28 views
0

如何從格式json或數組獲取podio api的響應,但不是對象? 我用波迪奧-PHP(https://github.com/podio/podio-php如何從格式json或數組獲取來自podio api的響應,而不是對象?

我的代碼

Podio::setup(CLIENT_ID_PODIO, CLIENT_SECRET_PODIO); 
    $oauth = Podio::is_authenticated(); 
    Podio::authenticate_with_app(111111, 
       'bergbttyjra74d5afgrfhgrh781e70'); 
    //$items = PodioItem::filter(111111); 
    $item = PodioItem::filter(111111, array(
     'filters' => array(
      'created_on' => array(
       "from" => "2017-10-09 00:00:00", 
       "to" => "2017-10-19 23:59:59" 
      ) 
     ), 
    )); 
    // print_r($item);// output object 
// how next ? 
+0

這有什麼錯對象? – ceejayoz

+0

我不知道如何從這個PodioByLine對象([__attributes:PodioObject:private] => Array([type] => user [id] => 4286469 [avatar_type] => file [avatar_id] => 422384899 [image] => Array([hosted_by] => podio [hosted_by_humanized_name] => Podio [thumbnail_link] => https://d2cmuesa4snpwn.cloudfront.net/public/422384899 [link] => https://d2cmuesa4snpwn.cloudfront .net/public/422384899 [file_id] => 422384899 [external_file_id] => [link_target] => _blank)[name] => FGfwegf fegfe –

+1

那麼閱讀文檔?http://podio.github.io/podio-php/objects/ – ceejayoz

回答

0

讓我們假設你真的需要一些其他的原因,比一個JSON或數組「我不知道做什麼用的對象做」。所以對於JSON只需使用as_json()函數。並獲得一個數組只是typecast an object

所以:

$json = $item->as_json(); // converts to json 
$array = (array) $item; // converts to array 

但@ceejayoz是正確的上述評論:對象本身是好的,只是RTFM :)

相關問題