php去掉html标签的函数是“strip_tags”,该函数的作用就是剥去字符串中的HTML、XML以及PHP的标签,其使用语法是“strip_tags(string,allow)”。
php入门到就业线上直播课:进入学习
Apipost = Postman + Swagger + Mock + Jmeter 超好用的API调试工具:点击使用
本文操作环境:Windows7系统、PHP7.1、Dell G3电脑。
strip_tags() 函数剥去字符串中的 HTML、XML 以及 PHP 的标签。
注释:该函数始终会剥离 HTML 注释。这点无法通过 allow 参数改变。
注释:该函数是二进制安全的。
语法
strip_tags(string,allow)
登录后复制
参数
string必需。规定要检查的字符串。
allow可选。规定允许的标签。这些标签不会被删除。
实例
剥去字符串中的 HTML 标签:
<?phpecho strip_tags("Hello <b>world!</b>");?>
登录后复制
输出:
Hello world!
登录后复制
【推荐:PHP视频教程】
以上就是php 去掉html标签的函数的详细内容,更多请关注php中文网其它相关文章!