php简单xml事务长

php简单xml事务长,php,xml,google-contacts-api,Php,Xml,Google Contacts Api,我是PHP简单XML文件解析器的新手 我有一个这样的XML文件 <?xml version='1.0' encoding='UTF-8'?> <feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gContact='http://schemas.google.com/contact/2008' xmlns:batch='

我是PHP简单XML文件解析器的新手 我有一个这样的XML文件

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gContact='http://schemas.google.com/contact/2008' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gd='http://schemas.google.com/g/2005'>
  <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact'/>
  <title type='text'>Aditya Technobd's Contacts</title>
  <generator version='1.0' uri='http://www.google.com/m8/feeds'>Contacts</generator>
  <entry>
    <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact'/>
    <title type='text'>Ashfaq Ali</title>
    <gd:email rel='http://schemas.google.com/g/2005#other' address='ashfaq@technobd.com' primary='true'/>
  </entry>
  <entry>
    <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact'/>
    <title type='text'>Farhad Hossain</title>
    <gd:email rel='http://schemas.google.com/g/2005#other' address='info@rpi-rangpur.com' primary='true'/>
  </entry>
</feed>

Aditya Technobd的联系人
联络
阿什法克阿里
法哈德侯赛因
我需要输出如下所示

姓名:阿什法克·阿里 电邮:ashfaq@technobd.com

姓名:法哈德·侯赛因 电邮:info@rpi-朗普网

我试过了,但代码找不到任何线索

$contacts = file_get_contents("public/temporary/contacts_sample.xml");
       $feed = simplexml_load_string($contacts);
       foreach($feed->entry as $entry){
           echo "Name: " .$entry->title; 
           echo "<br>";
       }
$contacts=file\u get\u contents(“public/temporary/contacts\u sample.xml”);
$feed=simplexml\u load\u字符串($contacts);
foreach($feed->entry as$entry){
echo“Name:”.$entry->title;
回声“
”; }

有谁能帮我找到电子邮件地址吗?我终于解决了这个问题

$contacts = file_get_contents("public/temporary/contacts_sample.xml");
       $feed = simplexml_load_string($contacts);
       foreach($feed->entry as $entry){
           echo "Name: " .$entry->title; 
           echo "<br>";
           echo "Email: " .$entry->children('gd', TRUE)->email->attributes()->address;
           echo "<br>";
       }
$contacts=file\u get\u contents(“public/temporary/contacts\u sample.xml”);
$feed=simplexml\u load\u字符串($contacts);
foreach($feed->entry as$entry){
echo“Name:”.$entry->title;
回声“
”; echo“Email:”.$entry->children('gd',TRUE)->Email->attributes()->地址; 回声“
”; }