php检测字符串中是否包含HTML代码
<?php function has_html($string){ if(strlen($string) != strlen(strip_tags($string))){ return true; } return false; } var_dump(has_html("This string doesn't have any html")); var_dump(has_html("This string has a<br />line break"));