Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/248.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Zend_Gdata昵称Feed-如何在php中访问用户名属性_Php_Zend Framework - Fatal编程技术网

Zend_Gdata昵称Feed-如何在php中访问用户名属性

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.

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.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 .= "&nbsp;&nbsp;".$loginName->userName;
  }
  echo "<p>".$login." - ". $nick."</p>";
}
$feed = $gdata->retrieveAllNicknames();

foreach ($feed as $nickname) {
    echo '  * ' . $nickname->nickname->name . ' => ' .
        $nickname->login->username . "\n";
}