0

我需要创建一个生成 html 代码的函数。这会将 html 输出到客户端进行复制。

我怎样才能做到这一点?

样品:

$htmlCode = "<div class='redRectangle'></div>";

如果我echo $htmlCode这将显示一个div,但我需要显示代码。

谁能帮我?

4

1 回答 1

9

使用该htmlentities功能。

echo htmlentities($htmlCode);
于 2013-11-07T15:52:45.567 回答