简体   繁体   中英

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. Is there a function in PHP that will automagically escape HTML code so it can be displayed?

print "<textarea>" . htmlspecialchars($html) . "</textarea>";

在这里,您可以从官方文档中找到有关htmlspecialchars的详细信息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM