Strip_tags removes HTML and PHP tags. Syntax: stringstrip_tags (stringstr); Return Value: string type: description of data processing content htmlspecialchars converts special characters into HTML format. Syntax: stringhtmlspecialchars (stringstring)
The method basically comes from the source code in the thinkphp, but I changed it a bit.
Copy CodeThe code is as follows:
/*
* @Description: Delete HTML tags and get plain text. can handle nested labels
*
*/
Class deletehtmltags{
Private
Because I sent XMLHTTP articles that batch crawled remote data some time agoHttp://blog.csdn.net/babyt/archive/2004/09/08/98516.aspxRecently, someone asked me how to save the article in text format, instead of simply using HTML storage, which will
Strip_tags removes HTML and PHP tags. Syntax: stringstrip_tags (stringstr); return value: string type: data processing content description this function can remove any HTML and PHP Mark strings contained in the string. If the HTML and PHP labels of
Before the Chinese word segmentation statistics, often have to crawl down the text contained in some of the tags, punctuation, English letters, such as filtering out, this process is called data
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 Strip_tags ($STR)
Strip_tagsGet rid of HTML and PHP tags.
Syntax: string strip_tags (String str);
return value: String
Types of functions: Data processing
Content Description
This function can remove any HTML and PHP tag strings contained in the string. If the HTML
Snoopy's powerful PHP collection class uses instance code. : Www.jb51.netcodes33397.html Snoopy some features: 1 capture the content of the web page fetch2 capture the web page text content (remove HTML tags) fetchtext3 capture web page chain: http:/
This article describes the use of PHP to remove HTML tags three ways, with the need for friends, refer to the next bar.Method 1, remove the desired tag directly. PHP functions are used: Str_replace, Htmlspecialchars, Strip_tags.
"," ", $str);/
Snoopy is a php class used to imitate the functions of a web browser. It can obtain webpage content and send forms. Official Website http://snoopy.sourceforge.net/
Some features of Snoopy:
Fetch ()
Capture the text content of a webpage (remove
: This article mainly introduces snoopy introduction and usage. if you are interested in the PHP Tutorial, refer to it. Snoopy is a php class used to simulate browser functions. it can obtain webpage content and send forms. To run Snoopy correctly,
Introduction to PHP capture collection class snoopy. Snoopy is a php class used to imitate the functions of a web browser. it can obtain webpage content and send forms. Some functions of snoopy. sourceforge. netSnoopy on the official website snoopy
The following is a reference clip:-----/**//// /// Remove HTML tags/// /// including the source code of HTML /// removed text Public static string nohtml (string htmlstring){// Delete the scriptHtmlstring = RegEx. Replace (htmlstring, @ "
Powerful PHP collection tool: Snoopy is a php class used to simulate the function of a browser. it can obtain webpage content and send forms. To run Snoopy correctly, the PHP version of your server is later than 4, and supports PCRE
PHP collection class Snoopy. class. php
SnoopyIt is a php collection class used to simulate a browser to obtain webpage content and send forms.The following are some Snoopy features:Easy to crawl webpage contentEasy to crawl page text
Snoopy is a php class used to simulate some simple functions of the browser. It can obtain webpage content and send forms. To run Snoopy correctly, the PHP version of your server is later than 4 and PCRE (Perl Compatible Regular Expressions) is
Here we will introduce two good php collection tools. One is Snoopy and the other is simple_html_dom. There are many ways to collect data (in essence 2-3, others are derived). php can also directly collect data using several methods. However, out of
This article mainly introduces the PHP snoopy collection class in detail, and the PHP collection class snoopy detailed usage tutorial. if you need a friend, refer to Snoopy as a php class to simulate the browser function, you can obtain the webpage
This article provides a detailed analysis of php Data Collection. For more information, see here. One is Snoopy and the other is simple_html_dom. There are many ways to collect data (in essence 2-3, others are derived). php can also directly collect
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.