mcaskill / php-strip-html
从字符串中删除HTML和PHP标签。
1.0.0
2017-11-24 13:47 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-09-20 20:00:43 UTC
README
(PHP 5 >= 5.4)
strip_html
— 从字符串中删除HTML和PHP标签。
描述
string strip_html( string $str )
此函数尝试返回一个字符串,其中包含从给定 str
中删除的所有NULL字节、HTML和PHP标签。与 strip_tags()
不同,此函数会注意换行符和元数据元素(例如,<style>
)。
此函数对于将富HTML字符串转换为纯文本字符串用于电子邮件非常有用。
参数
str
— 输入字符串。
返回值
返回删除标签后的字符串。
安装
使用Composer
$ composer require mcaskill/php-strip-html
不使用Composer
为什么不使用 composer?从gist下载 Function.Strip-HTML.php
并将其保存到项目路径的某个位置。