Php removes html tag function code

Source: Internet
Author: User
Tags php code examples
Php removes html tag function code

  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 ("/<\/p>/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 the content
  24. $ Content = preg_replace ("/ ] * -->/I ",'', $ content); // comment the content
  25. $ Content = preg_replace ("/style =. +? ['| \ "]/I", '', $ content); // remove the style
  26. $ Content = preg_replace ("/class =. +? ['| \ "]/I", '', $ content); // remove the style
  27. $ Content = preg_replace ("/id =. +? ['| \ "]/I", '', $ content); // remove the style
  28. $ Content = preg_replace ("/lang =. +? ['| \ "]/I", '', $ content); // remove the style
  29. $ Content = preg_replace ("/width =. +? ['| \ "]/I", '', $ content); // remove the style
  30. $ Content = preg_replace ("/height =. +? ['| \ "]/I", '', $ content); // remove the style
  31. $ Content = preg_replace ("/border =. +? ['| \ "]/I", '', $ content); // remove the style
  32. $ Content = preg_replace ("/face =. +? ['| \ "]/I", '', $ content); // remove the style
  33. $ Content = preg_replace ("/face =. +? ['| \ "]/", '', $ Content );
  34. $ Content = preg_replace ("/face =. +? ['| \ "]/", '', $ Content );
  35. $ Content = str_replace ("", "", $ content );
  36. Return $ content;
  37. }

>>> Articles you may be interested in: PHP code for deleting html tags php code for determining whether a string contains html tags for extracting html tags php code examples for extracting HTML tags php two ways for removing HTML tags php remove redundant html tag php regular query html tags containing id attributes php use strip_tags to completely remove all html tags examples share php three ways to delete html tags share php delete html tags and html tags in strings php code to remove the html tag in the string. the Function extracts the html tag. php code: php regular filter. html tags, spaces, line breaks, and other code examples fix HTML tags that are not properly closed (nested and close nearby) php code to remove html tags to obtain the code of the input plain text document strip_tagsphp to enable HTML tags to automatically complete the closure function php code to implement html tag auto-completion code

Related Article

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.