Home >php教程 >php手册 >php 判断字符串中是否包含html标签

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

WBOY
WBOYOriginal
2016-06-06 20:24:501785browse

本篇文章主要是对使用php判断字符串中是否包含html标签的实例代码进行了介绍,需要的朋友可以过来参考下,希望对大家有所帮助

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