PHP DOMDocument replace DOMElement child with HTML string

后端 未结 5 1575
[愿得一人]
[愿得一人] 2020-12-31 13:09

Using PHP I\'m attempting to take an HTML string passed from a WYSIWYG editor and replace the children of an element inside of a preloaded HTML document with the new HTML.

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-31 14:03

    You can use loadHTML() on a fragment of code and then append the resulting created nodes into the original DOM tree.

提交回复
热议问题