DOMDocument->saveHTML() converting   to space

前端 未结 2 1672
隐瞒了意图╮
隐瞒了意图╮ 2021-01-20 01:33

In my code, I have

$document = DomDocument->loadHTML($someHTML);
$xPath = new DOMXPath($document);
//
//do some xpath query and processing
//
$result = $d         


        
相关标签:
2条回答
  • 2021-01-20 02:00

    replace   with   then when the htmlDom doc is read it will return  

    0 讨论(0)
  • 2021-01-20 02:05
    $someHTML = str_replace (' ', '@nbsp;', $someHTML);
    $document = DomDocument->loadHTML($someHTML);
    $xPath = new DOMXPath($document);
    //
    //do some xpath query and processing
    //
    $result = $document->saveHTML();
    $result = str_replace ('@nbsp;', ' ', $result);
    
    0 讨论(0)
提交回复
热议问题