Gaz*_*ion 2 php rss namespaces simplexml atom-feed
这是我加载到simplexml对象中的RSS模板.我想改变
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<atom:link href="link" rel="self" type="application/rss+xml" />
<title></title>
<link></link>
<description></description>
<lastBuildDate></lastBuildDate>
</channel>
</rss>
Run Code Online (Sandbox Code Playgroud)
我想更改atom:link中的href属性,但我不知道如何访问它.我通过SO搜索并发现了一些关于如何访问不同命名空间的信息,但我无法弄清楚如何将它们应用于这个特定的例子(主要是因为我非常密集:)
我可以使用下面的代码行修改我的链接属性,但是如何修改上面提到的属性?
$rss->channel->link = $rssLink;
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激!
$attrs = $rss->channel->children("atom", true)->link->attributes();
$attrs["href"] = "href_value";
Run Code Online (Sandbox Code Playgroud)
这里的例子.