[英]How to make HTML code as readable in PHP
I want to show <li> </li>
in at my php page. 我想在我的PHP页面上显示<li> </li>
。 But when i am writing this code i am getting HTML ourput as List tag. 但是,当我编写此代码时,我将HTMLourput作为List标记。 But i want to show the example code as <li>This is first line </li>
there 但我想将示例代码显示为<li>This is first line </li>
How can i show that. 我如何证明这一点。 I know that there need to use \\ to make any code readable is PHP. 我知道需要使用\\来使任何代码可读的是PHP。 So i used, \\<li>This is first line </li>\\
But i did not get proper result which i want. 因此,我曾经使用\\<li>This is first line </li>\\
但是我没有得到想要的正确结果。
Anyone can help by sharing that code? 任何人都可以通过共享该代码来提供帮助吗?
Check function htmlentities . 检查功能htmlentities 。
$str = "A 'quote' is <b>bold</b>";
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str);
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str, ENT_QUOTES);
Try like 尝试像
<li> This is first line </li>
Either you can use htmlentities
like 要么你可以使用htmlentities
样
echo htmlentities('<li>This is first line </li>');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.