Php 如何从podio api获取json或数组格式而非对象格式的响应?
如何从podio api获取json或数组格式而非对象格式的响应? 我使用podiophp 我的代码Php 如何从podio api获取json或数组格式而非对象格式的响应?,php,json,podio,Php,Json,Podio,如何从podio api获取json或数组格式而非对象格式的响应? 我使用podiophp 我的代码 Podio::setup(CLIENT_ID_PODIO, CLIENT_SECRET_PODIO); $oauth = Podio::is_authenticated(); Podio::authenticate_with_app(111111, 'bergbttyjra74d5afgrfhgrh781e70'); //$item
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 ?
让我们假设您真的需要一个JSON或数组,因为我不知道如何处理一个对象。因此,对于JSON,只需使用as_JSON函数。为了得到一个数组 因此:
但是@ceejayoz在上面的评论中是正确的:对象本身是好的,只是RTFM:对象有什么问题吗?我不知道如何从对象获取数据,因为这个PodioByLine对象[\uu属性:PodioObject:private]=>Array[type]=>user[id]=>4286469[avatar\u type]=>文件[avatar_id]=>422384899[image]=>Array[hosted_by]=>podio[hosted_by_humanized_name]=>podio[thumbnail_link]=>[link]=>422384899[external_file_id]=>[link_target]=>blank[name]=>FGfwegf fegfeSo阅读文档?是的,我阅读了文档。文档解释了如何使用对象及其数据,包括代码示例。
$json = $item->as_json(); // converts to json
$array = (array) $item; // converts to array