开发者

PHP Escaping angle brackets for <!--HTML-->?

Having a lot of trouble escaping angle brackets..

$embeds = preg_replace(<!--nextpage-->, '', $embeds,开发者_如何学Go 1);

Did find that strip_tags() is suppose to do the trick, but must have messed up somewhere.

What would be the best way to remove the < !--nextpage-->?


Do you want to strip or to escape angel brackets?

Stripping works with strip_tags() if the HTML is valid. Example: $embeds = strip_tags($embeds);

Escaping can be done using html_special_chars(). Example: $embeds = htmlspecialchars($embeds, ENT_NOQUOTES);

You can try the following as well:

preg_replace('/<!--.+-->/U', '', $embeds)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜