问题描述
|
使用
simplexml_load_string
如何从Feed中以以下格式获取openSearch:itemsPerPage
值:
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_understanding_video_feeds.html
解决方法
在SimpleXML中,您可以使用children(\'prefix \',true)和attribute(\'prefix \',true)函数访问命名空间的内容。
$xml = simplexml_load_string($string);
$itemsPerPage = (string)$xml->children(\'opensearch\',true)->itemsPerPage;