Cat Share, must boutiqueOriginal articles, welcome reprint. Reprint Please specify: Sanayu's BlogAddress: http://blog.csdn.net/u013357243One: The problem, the data returned by the server has a large string of HTML, but we only use strings, because
Remove unnecessary HTML tags from php
Echo strip_tags ($ str );
2. retain onlyFor a tag, you only needThe string is written to the second parameter of strip_tags.
Echo strip_tags ($ str ,"");
3.
Remove HTML tags from webpages using regular expressionsRegular Expression htmlAfter capturing the data of a webpage (such as the description), if it is displayed as is, the format may be messy because it contains no closed HTML Tag, it may also
PHP implementation of closed HTML tags, PHP complement HTML tags
The example in this article describes the HTML tags that PHP implements to close. Share to everyone for your reference, as follows:
Most of the time, when we make a fuss about
The most common way to remove HTML tags from a paragraph of text in order to eliminate the styles and paragraphs contained therein is the regular expression. Note, however, that regular expressions do not handle all HTML documents, so it is
PHP strip_tags () goes to the function of HTML, XML, and PHP tags in the string, Strip_tagsxml
Strip_tags Definition and usage
The Strip_tags () function strips the HTML, XML, and PHP tags from the string.
Note: This function always strips HTML
Remove the HTML tag from a text segment to remove the style and paragraph contained in it. The most common method may be regular expressions. However, you must note that regular expressions cannot process all HTML documents. Therefore, it is better
After reading data from the database, it is displayed as html tags and html tags.
Maybe the data read by many people from the database does not need to be converted into html tags, but one day you may find that when we need to output html tags, the
'*************************************** ***********
'Function name: gottopic
'Usage: String truncation. One Chinese character is counted as two characters, and one English character is counted as one character.
'Parameter: Str ---- original string
'
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.