首页 >后端开发 >php教程 >php怎么检测字符串是否包含html代码

php怎么检测字符串是否包含html代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-07-25 08:51:361314浏览
  1. function has_html($string){

  2. if(strlen($string) != strlen(strip_tags($string))){
  3. return true;
  4. }
  5. return false;
  6. }
  7. var_dump(has_html("This string doesn't have any html"));

  8. var_dump(has_html("This string has a
    line break"));
复制代码


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn