Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要创建一个生成 html 代码的函数。这会将 html 输出到客户端进行复制。
我怎样才能做到这一点?
样品:
$htmlCode = "<div class='redRectangle'></div>";
如果我echo $htmlCode这将显示一个div,但我需要显示代码。
echo $htmlCode
div
谁能帮我?
使用该htmlentities功能。
htmlentities
echo htmlentities($htmlCode);