How to display XML in HTML in PHP?

后端 未结 5 1964
南笙
南笙 2020-11-28 10:40

I have a string with XML:

$string = 
\"

    
       Shoue
    

\";
<         


        
5条回答
  •  不知归路
    2020-11-28 11:17

    I searched for a solution to have slightly coloured output:

    $escaped = htmlentities($content);
    $formatted = str_replace('<', '<', $escaped);
    $formatted = str_replace('>', '>', $formatted);
    echo "
    $formatted
    \n";

提交回复
热议问题