[英]I would like to display a code snippet in a text area so it can easily be cut and pasted, how?
I am generating a bit of code to display a picture as a link (frex <a href="site.com"><img src="/image.gif"></a>
) I would like to show how it look, but also in a textbox adjacent show the actual code. 我正在生成一些代码以将图片显示为链接(frex
<a href="site.com"><img src="/image.gif"></a>
),我想展示它的外观,还可以在相邻的文本框中显示实际代码。 Is there a function in PHP that will automagically escape HTML code so it can be displayed? PHP中是否有一个可以自动转义HTML代码以便可以显示的函数?
print "<textarea>" . htmlspecialchars($html) . "</textarea>";
在这里,您可以从官方文档中找到有关htmlspecialchars的详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.