DOMDocument append already fixed html from string

前端 未结 1 1321
被撕碎了的回忆
被撕碎了的回忆 2020-12-21 19:22

So im trying to show a snapshot html from a page using DOMDocument. What i have so far is my home page which i load from a remote location

$dom = new DOMDoc         


        
相关标签:
1条回答
  • 2020-12-21 19:36

    I think what you need to do is create a document fragment:

    $div = $dom->createElement( 'div'); // No $contents here
    $fragment = $dom->createDocumentFragment();
    $fragment->appendXML( $content);
    $div->appendChild( $fragment);
    
    0 讨论(0)
提交回复
热议问题