Home  >  Article  >  Backend Development  >  PHP function to filter HTML code spaces, carriage returns and line feeds

PHP function to filter HTML code spaces, carriage returns and line feeds

WBOY
WBOYOriginal
2016-07-25 09:06:311449browse
PHP function to filter html code spaces and carriage returns and line feeds ​ ​ ​ ​ ​ ​ ​ ​
                 
                                                                                                                                                                                                                                                                                                       


/**
* PHP function to filter HTML code spaces, carriage returns and line feeds
    * echo deletehtml()
  1. */
  2. function deletehtml($str)
  3. {
  4. $str = trim($str);
  5. $str=strip_tags($str,"");
  6. $str=preg_replace( "{t}","",$str);
  7. $str=preg_replace("{rn}","",$str);
  8. $str=preg_replace("{r}","",$str) ;
  9. $str=preg_replace("{n}","",$str);
  10. $str=preg_replace("{ }","",$str);
  11. return $str;
  12. }
  13. Copy code
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