PHP removes HTML tag function code

Source: Internet
Author: User
  1. function nohtml ($content)
  2. {
  3. $content = Preg_replace ("/]*>/i", "', $content);
  4. $content = Preg_replace ("/<\/a>/i", "', $content);
  5. $content = Preg_replace ("/]*>/i", "', $content);
  6. $content = Preg_replace ("/<\/div>/i", "', $content);
  7. $content = Preg_replace ("/]*>/i", "', $content);
  8. $content = Preg_replace ("/<\/font>/i", "', $content);
  9. $content = Preg_replace ("/ ]*>/i", "', $content);
  10. $content = Preg_replace ("/<\/p>/i", "', $content);
  11. $content = Preg_replace ("/ ]*>/i", "', $content);
  12. $content = Preg_replace ("/<\/span>/i", "', $content);
  13. $content = Preg_replace ("/<\?xml[^>]*>/i", "', $content);
  14. $content = Preg_replace ("/<\/\?xml>/i", "', $content);
  15. $content = Preg_replace ("/ ]*>/i", "', $content);
  16. $content = Preg_replace ("/<\/o:p>/i", "', $content);
  17. $content = Preg_replace ("/ ]*>/i", "', $content);
  18. $content = Preg_replace ("/<\/u>/i", "', $content);
  19. $content = Preg_replace ("/ ]*>/i", "', $content);
  20. $content = Preg_replace ("/<\/b>/i", "', $content);
  21. $content = Preg_replace ("/ ]*>/i", "', $content);
  22. $content = Preg_replace ("/<\/meta>/i", "', $content);
  23. $content = Preg_replace ("//I ", "', $content);//comment content
  24. $content = Preg_replace ("/ ]*-->/i", "', $content);//comment content
  25. $content = Preg_replace ("/style=.+?[" | \ "]/i", ", $content);//Remove style
  26. $content = Preg_replace ("/class=.+?[" | \ "]/i", ", $content);//Remove style
  27. $content = Preg_replace ("/id=.+?[" | \ "]/i", ", $content);//Remove style
  28. $content = Preg_replace ("/lang=.+?[" | \ "]/i", ", $content);//Remove style
  29. $content = Preg_replace ("/width=.+?[" | \ "]/i", ", $content);//Remove style
  30. $content = Preg_replace ("/height=.+?[" | \ "]/i", ", $content);//Remove style
  31. $content = Preg_replace ("/border=.+?[" | \ "]/i", ", $content);//Remove style
  32. $content = Preg_replace ("/face=.+?[" | \ "]/i", ", $content);//Remove style
  33. $content = Preg_replace ("/face=.+?[" | \ "]/", ", $content);
  34. $content = Preg_replace ("/face=.+?[" | \ "]/", ", $content);
  35. $content =str_replace ("", "", $content);
  36. return $content;
  37. }
Copy Code

>>> you may be interested in the article: PHP Delete HTML tag code PHP determine whether the string contains HTML tags extract HTML tags PHP code sample PHP method of extracting HTML tags PHP two ways to remove HTML tags PHP Remove redundant HTML tags PHP is looking for HTML tags that contain ID attributes in HTML PHP with STRIP_ Tags complete removal of all instances of HTML tags share php delete HTML tags three ways to share PHP delete HTML tags and strings in the HTML tags of the code PHP delete string HTML tags in the function of extracting HTML tags PHP code PHP regular filter HTML tags, Code examples for spaces, line breaks, etc. fix HTML tags that are not properly closed (supports nesting and closing close) code for PHP to remove HTML tags to get input plain text document strip_tagsphp HTML tag auto complement closed function code PHP implementation HTML Tag Auto-complete

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.