我在我的网站上有一个允许使用HTML的输入表单,我正在尝试添加关于使用HTML标签的说明。我想让这文本
<strong>Look just like this line - so then know how to type it</strong>
但目前为止我只知道
看起来就像这一行,这样你就知道怎么打了
我如何显示标签,让人们知道该输入什么?
我在我的网站上有一个允许使用HTML的输入表单,我正在尝试添加关于使用HTML标签的说明。我想让这文本
<strong>Look just like this line - so then know how to type it</strong>
但目前为止我只知道
看起来就像这一行,这样你就知道怎么打了
我如何显示标签,让人们知道该输入什么?
当前回答
要在浏览器中显示HTML标记,可以用< xmp>和< / xmp>标记包围输出
其他回答
你只需要编码<>s:
<strong>Look just like this line - so then know how to type it</strong>
在PHP中使用htmlspecialchars()函数来转义<和>。
htmlspecialchars('<strong>something</strong>')
原生JavaScript方法-
('<strong>Look just ...</strong>').replace(/</g, '<').replace(/>/g, '>');
享受吧!
要在浏览器中显示HTML标记,可以用< xmp>和< / xmp>标记包围输出
将<替换为<>和>