php - About the display of htmlentities
怪我咯
怪我咯 2017-05-16 13:05:25
0
5
839
$str = "A 'quote' is <b>bold</b>";

// Output: A 'quote' is <b>bold</b>
echo htmlentities($str);

Example from the official website, why when I use it, the page still displays A 'quote' is bold instead of the content in the comment

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(5)
过去多啦不再A梦

If it’s just this piece of code, there will be no problem running it!

It depends on whether you have other codes that are affected

曾经蜡笔没有小新

Right click -> View web page source code

为情所困

Press F12 > Network > Response to view the parameters of the link response. The default browser will escape the ascii code for you.

淡淡烟草味

There is no problem with the running result because this kind of string ‘<’ is parsed by the browser; if you really want to output it like this

<?php
$str = "A 'quote' is <b>bold</b>";

// 输出: A 'quote' is <b>bold</b>

echo  htmlentities(htmlentities($str)).'<br>';
洪涛

https://zhidao.baidu.com/ques...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template