简体   繁体   中英

PHP REGEX Exclude Certain Tags?

For REGEX, I am wondering how I would clear all HTML tags entered except for the simple ones, such as <a>, <b>, <i>, <pre> . I know that I can use this regex to exclude all html charicters, but I am not sure how I would go about only removing some, and deleting the others while conserving the content inside. Thanks!

See the second parameter in :

http://php.net/strip_tags

Essentially, you can call this function and list the tags you don't' want to be stripped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM