@charset "Utf-8";/*! * @ Name: Base.css * @ function: 1, reset browser Default style * 2, set generic atomic class*//*prevents users from customizing the effect of background color on Web pages, adding allows users to customize
1: // 2: /// Remove HTML tags 3: // 4: /// including HTML source code 5: /// removed text after 6: public staticstring removehtml (string htmlstring) 7: { 8: if
The example in this article tells you that PHP still has a blank solution for using strip_tags () to remove HTML tags. Share to everyone for your reference, specific as follows:
$subject = Strip_tags ($newsRs [' content ']);//Remove HTML tag
First, the Web page content of the entire crawl down, the data put in byte[] (network transmission on the form of byte), further converted to string, so as to facilitate its operation, examples are as follows:
Copy Code code as follows:
Method One: Disable HTMLThe easiest way to do this is to disable HTML tags directly without removing them. You can use the Replace () function. For example:
StrText = Replace (StrText, "
or disable all HTML directly:StrText = Replace (StrText,
HTML tags | Just because of my previous time XMLHTTP bulk crawl Remote Data articles
Http://blog.csdn.net/babyt/archive/2004/09/08/98516.aspx
Recently someone asked me how to save the article in text format instead of using HTML directly, which
When we use ckeditor or some other online text editors, there are a lot of labels in the content:
A journey of life, a journey of scenery, a journey of prosperity. Open the window of the soul, watching the time and the flowers bloom, watching the
Usually we use Htmlspecialchars () to filter the HTML, but the HTML characters escaped, the final display is the HTML source code.
You can use Strip_tags () to get rid of HTML tags.
$str = ' href ';echo Htmlspecialchars ($STR);echo
/// /// Convert the HTML tag to Kong Jia Shiyi/// /// string to be converted /// converted string Public static string getstringnohtml (string strhtml){If (string. isnullorempty (strhtml )){Return strhtml;}Else{String [] aryreg = {@ " ",@ " )? ",@
/// /// Convert the HTML tag to Kong Jia Shiyi/// /// string to be converted /// converted string Public static string getstringnohtml (string strhtml){If (string. isnullorempty (strhtml )){Return strhtml;}Else{String [] aryreg = {@ " ",@ " )? ",@
Strip_tags get rid of HTML and PHP tags.Syntax: string strip_tags (String str);return value: StringTypes of functions: Data processingContent DescriptionThis function can remove any HTML and PHP tag strings contained in the string. If the HTML and
01./**02. * Remove the HTML code inside the string. 03. * Require data to be standardized, such as greater than less than the number to support, or will be the collective manslaughter.04. ** @param content* ContentThe contents of @return
Original reprint Please indicate the source:
Using regular processing, do not know whether there will be performance problems, not too much testing.
At present I have a lot of use beautifulsoup to do this kind of processing.
The HTML entity deals
The method basically comes from the source code in the thinkphp, but has been modified by me
Copy Code code as follows:
/*
* @Description: Delete HTML tags and get plain text. can handle nested labels
*
*/
Class deletehtmltags{
Today, I was suddenly asked to read data from the database sometimes with HTML tags, and if the data is packed in a container such as TextBox, the tags will be output as strings, this is definitely not your own effect, so how to remove these HTML
PHP strip_tags () function
Definition and usage
The strip_tags () function removes tags from HTML, XML, and PHP.Syntax
strip_tags(string,allow)
Parameters
Description
String
Required. Specifies the string to be checked.
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.