在PHP中打印小于和大于符号 [英] Print less-than and greater-than symbols in PHP
本文介绍了在PHP中打印小于和大于符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用PHP在HTML中打印< / code>
>
符号时遇到麻烦。
I am have troubles trying to print out <
>
symbols in HTML using PHP.
我将一个字符串< machine>
附加到一个变量中。
I am appending a string "<machine>
" to a variable.
示例:
Example:
$output .= " <machine> ";
echo $output;
我尝试过使用转义符,但这并没有帮助。任何建议?
I tried using escapes, but that didn't help. Any advice?
推荐答案
& gt;
= >
& lt;
= <
或者您可以使用 htmlspecialchars
。
Or you can use htmlspecialchars
.
$output .= htmlspecialchars(" <machine> ");
这篇关于在PHP中打印小于和大于符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文