-1

我想做的是使用 simplexml 从 Youtube 视频 URL 读取内容 xml 标记,但是当我添加属性函数时,它给了我错误:

在非对象上调用成员函数 attributes()

php代码:

$xml = simplexml_load_file("http://gdata.youtube.com/feeds/api/videos/FS5uQpBp8XI/related?v=2");

$content = $xml->children("http://search.yahoo.com/mrss/")->group->content[0]->attributes();

$src = $content->url;

echo $src;
4

1 回答 1

0

You are calling a method that is not belong to the simple xml object. Try to use the print_r so you can find which attribute are you suppose to print out

于 2012-07-22T17:28:13.220 回答