Home >Backend Development >PHP Tutorial >php 判断字符串中是否包含html标签_php技巧

php 判断字符串中是否包含html标签_php技巧

WBOY
WBOYOriginal
2016-05-17 08:49:251158browse

function judgeHtml($str){
 if($str != strip_tags($str)){
  echo '有';
 }else{
  echo '无';
 }
}
judgeHtml('

a');
echo '
';
judgeHtml('a');
输出:有
      无

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn