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:
<Carlos>
http://us2.php.net/manual/en/function.htmlspecialchars.php
Do you mean you want to print
<Carlos>
? 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
<Carlos>
精彩评论