HTML tag |javascript
/*** Remove all HTML tags and javascript tags*/function Replacehtmlandjs ($document) {$document = trim($document); if (strlen($document) 0) { return $document ; }$search = Array ("' ' si", Remove JavaScript"' ]*?>' Si ',
Small functions that remove HTML tags and javascript code
Function trip_html ($ html, $ len ){
// $ Html should contain an HTML document.
// In this example, the HTML tag and javascript code are removed.
Method 1: Disable html
The simplest way is to directly disable HTML tags without removing them. You can use the Replace () function. For example:
Strtext = Replace (strtext, "
Or directly disable all HTML:Strtext = Replace (strtext, "
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,
In some cases, we need to get part of a block of HTML contents, if truncate it directly, the HTML tags will be truncated, too.
So before truncating, we have to remove all the HTML tags in the content.
The following JavaScript codes is used to
Php uses strip_tags () to remove html tags.
The example in this article describes how php uses strip_tags () to remove html tags. We will share this with you for your reference. The details are as follows:
$ Subject = strip_tags ($ newsRs ['content']
When using the Empire tag template, you must intercept the string, but if you setIntroductionThe html Tag is displayed on the front-end. My solutions are now released. The first user of my empire. If the problem occurs, you are welcome to leave a
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.