Zend_Gdata昵称Feed-如何在php中访问用户名属性
Gapps类(与Google Provisioning API相关)中的retrieveAll昵称()函数返回如下元素:Zend_Gdata昵称Feed-如何在php中访问用户名属性,php,zend-framework,Php,Zend Framework,Gapps类(与Google Provisioning API相关)中的retrieveAll昵称()函数返回如下元素: <atom:entry> <atom:id> https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/suse </atom:id> <atom:category scheme="http://schemas.google.
<atom:entry>
<atom:id>
https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/suse
</atom:id>
<atom:category scheme="http://schemas.google.com/g/2005#kind"
term="http://schemas.google.com/apps/2006#nickname"/>
<atom:title type="text">suse</atom:title>
<atom:link rel="self" type="application/atom+xml"
href="https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/suse"/>
<atom:link rel="edit" type="application/atom+xml"
href="https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/suse"/>
<apps:nickname name="suse"/>
<apps:login userName="SusanJones"/>
</atom:entry>
这会在第29行反复生成“未定义变量:登录/Applications/MAMP/htdocs/google_api/get_昵称.php”(每个条目一个),其中第29行是回显行。根据位于的文档,您可以使用以下代码:
$feed = $gdata->retrieveAllNicknames();
foreach ($feed as $nickname) {
echo ' * ' . $nickname->nickname->name . ' => ' .
$nickname->login->username . "\n";
}
谢谢这是一个非常有用的链接,也是我搜索时谷歌没有返回的链接。
$nicknames = $service->retrieveAllNicknames();
foreach ($nicknames->entries as $entry) {
$nick = $entry->nickname;
foreach ($entry->login as $loginName) {
$login .= " ".$loginName->userName;
}
echo "<p>".$login." - ". $nick."</p>";
}
$feed = $gdata->retrieveAllNicknames();
foreach ($feed as $nickname) {
echo ' * ' . $nickname->nickname->name . ' => ' .
$nickname->login->username . "\n";
}