开发者

Avoiding html thinking you are using a custom tag

I am tryi开发者_StackOverflow社区ng to output a text value from a php array. The value is

<Carlos>

However when echo'd to the page nothing shows because the browser has transformed it to

<Carlos></Carlos>

How do I stop it from transforming it into tags?


Escape it, for example using htmlentities(). You'd end up with:

&lt;Carlos&gt;


http://us2.php.net/manual/en/function.htmlspecialchars.php


Do you mean you want to print

&lt;Carlos&gt;

? Apply htmlentities on the string to echo.


if all you've written on the page is <Carlos> HTML won't automatically parse it to <Carlos></Carlos>. I reckon its the view source of your browser.

try

&lt;Carlos&gt;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜