在网页中包含HTML标记作为纯文本

Eug*_*ene 1 html html-parsing

在网页中以纯文本形式显示有效HTML的正确方法是什么?

Fel*_*Als 6

    <pre>
      <code>
        <!-- As seen on stackoverflow.com, and it's correct -->
        <p class="inception">valid HTML</p>
      </code>
    </pre>
Run Code Online (Sandbox Code Playgroud)

  • 并[编码HTML](http://jsfiddle.net/B7448/),以便您可以看到受影响的标记.例如,PHP有[htmlentities()](http://php.net/manual/en/function.htmlentities.php). (2认同)