I am working with htmlentites()
to replace characters with safe html, namely the PHP because I want to be able to show PHP examples. The problem I am running into is all the tags are replaced (ex: </p>
, </br>
etc). I know I can write a custom htmentities to only replace the <?
tags and other specific xm开发者_高级运维l tags but I was wondering is there something in PHP that already does this?
I would use the highlight_string()
function in PHP as it will escape the characters and syntax highlight the code.
精彩评论