php字符串过滤函数strip_tags()如何使用
strip_tags()函数用于从字符串中删除HTML和PHP标签。它的语法以下:
```php
string strip_tags ( string $str [, string $allowable_tags ] )
```
参数说明:
- `$str`:要过滤的字符串
- `$allowable_tags`:可选参数,允许保存的标签列表。如果指定了该参数,只有这些标签会被保存,其他标签都会被删除。
示例用法:
```php
$str = "
Hello, world!
";Hello, world!
";
TOP