【发布时间】:2012-07-08 10:05:23
【问题描述】:
我想用 PHP DOMDocument 更改标签的属性值。
例如,假设我们有这行 HTML:
<a href="http://foo.bar/">Click here</a>
我在PHP中加载上述代码如下:
$dom = new domDocument;
$dom->loadHTML('<a href="http://foo.bar/">Click here</a>');
我想使用 PHP 的 DOMDocument 扩展将“href”值更改为“http://google.com/”。这可能吗?
一如既往地感谢您的帮助!
【问题讨论】:
标签: php dom attributes tags domdocument