2014-10-18 57 views
0

我有一个链接字段叫lien。当我通过Item它属于API得到它,我收到以下阵列:你如何获得“嵌入”的价值?

[lien] => Array(
    [0] => Array(
     [embed] => 49935230 
     [file] => 129256002 
    ) 
) 

我有文件没问题。

如何获得URL值?

Embeds文档:https://developers.podio.com/doc/embeds

通过Item对象得到一个类别字段的值时,也存在类似的问题。它是所选option_id的数组,它不包含option_text。解决方法是使用提供的option_id获取相应的App对象并搜索option_text

+0

您使用的客户端库:您可以看到文档?如果是这样的话? – 2014-10-19 04:40:01

+0

podio-php 4.0.0 – 2014-10-19 17:49:25

回答

2

该字段的值作为嵌入对象的集合返回。 http://podio.github.io/podio-php/fields/#linkembed-field

例如为:

$item = PodioItem::get_basic(123); 
$field_id = 'embed'; 
$collection = $item->fields[$field_id]->values; 

foreach ($collection as $embed) { 
    print "Embed id: ".$embed->embed_id; 
    print "Embed URL: ".$embed->original_url; 
} 
+0

没错。我得到的输出来自对象的'file_put_contents'。我认为还有类别字段选项的对象集合? – 2014-10-20 18:59:08

+0

您可以在该页面上查看所有字段类型的示例http://podio.github.io/podio-php/fields/ – 2014-10-20 21:59:59