【发布时间】:2011-12-19 06:45:34
【问题描述】:
我有下面的xml
<entry>
<id></id>
<title></title>
<dc:identifier></dc:identifier>
<dc:identifier></dc:identifier>
<dc:relation></dc:relation>
<dc:publisher></dc:publisher>
<dc:language xsi:type="dcterms:ISO639-2"></dc:language>
<dcterms:issued></dcterms:issued>
<updated></updated>
<rights></rights>
<author>
<name></name>
<uri></uri>
</author>
<link rel="alternate" href="" type="text/html"/>
<link rel="http://opds-spec.org/image" href="" type="image/jpeg"/>
<link rel="http://opds-spec.org/image/thumbnail" href="" type="image/jpeg"/>
<link rel="http://opds-spec.org/acquisition/buy" href="" type="application/epub+zip">
<opds:price currencycode="EUR"></opds:price>
</link>
<summary type="text"></summary>
</entry>
<entry>
<id></id>
<title></title>
<dc:identifier></dc:identifier>
<dc:identifier></dc:identifier>
<dc:relation></dc:relation>
<dc:publisher></dc:publisher>
<dc:language xsi:type="dcterms:ISO639-2"></dc:language>
<dcterms:issued></dcterms:issued>
<updated></updated>
<rights></rights>
<author>
<name></name>
<uri></uri>
</author>
<link rel="alternate" href="" type="text/html"/>
<link rel="http://opds-spec.org/image" href="" type="image/jpeg"/>
<link rel="http://opds-spec.org/image/thumbnail" href="" type="image/jpeg"/>
<link rel="http://opds-spec.org/acquisition/buy" href="" type="application/epub+zip">
<opds:price currencycode="EUR"></opds:price>
</link>
<summary type="text"></summary>
</entry>
......
解析所有项目时我可以很好地解析它(simpleXML)
现在我想同时获取一个项目。所以我将一个 var 传递给我的文件,例如
file.php?start=1
file.php?start=2
etc
我试图访问当前项目
$xml->entry[$start] returns NULL
或
$xml->entry->{$start} returns NULL
但两者都返回 NULL
我尝试直接访问它
$xml->entry[1]
$xml->entry->{1}
它的工作正常
我错过了什么吗?
【问题讨论】: