开发者

PHP HTMLEntities for specific elements

开发者 https://www.devze.com 2023-02-25 05:03 出处:网络
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: <

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.

0

精彩评论

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

关注公众号