2
我想要像在jQuery .html()中一樣重新生成div的內容。這是我迄今爲止所做的:PHP DOMDocument取代div的內容編號
$html = "
<html>
<body>
<div id="main">
<div id="text">
<p>This is some text</p>
</div>
</div>
</body>
</html>
";
$doc = new DOMDocument();
$doc->loadHTML($html);
// change div id "text" contents
// $("#text").html("<p>This is some new text</p>");
echo $doc->saveHTML();
任何幫助,將不勝感激!謝謝。
謝謝!像魅力一樣工作。 – user2086252
是不是getElementById而不是documentGetElementById? – Chrisissorry