How to check in yii/php if string have any disallowed HTML in it?

291 Views Asked by At

In my project I use php and yii framework. I have a predefined set of the disallowed html tags(for example - "script, object") and I need to check that entered text don't contain any of these tags.

What function I can use in order to do that ?

1

There are 1 best solutions below

3
On BEST ANSWER

If you're dealing with potentially unsafe HTML from the client (WYSIWYG editors etc.), I'd use a library like HTML Purifier. It lets you to specify allowed and disallowed tags.