Php string processing function (below)

Source: Internet
Author: User
: This article mainly introduces the php string processing function (below). If you are interested in the PHP Tutorial, please refer to it. HTML tag-related string formatting

If a common post is used to receive webpage input information

 ";//echo stripslashes(addslashes($title))."
";//echo htmlspecialchars($title);}?>

This is my input 1234But I'm so scared. what if I transfer bad code to destroy your webpage?

At this time, the string format associated with our HTML tag is blank

stripslashes(addslashes($title))
Enter what is displayed, delete the escape character, and add the escape character ...... ()

Function: nl2br ()
Syntax: string nl2br (string) converts "\ n" in the string into an HTML linefeed"
"
Function: htmlspecialchars ()
Syntax: string htmlspecialchars (string [,
Int quote_style [, string charset]) converts a specified special symbol to an object, as shown in <>
'&': '"'
''': ''' <':' <'
'>': '>'
Function: htmlentities ()
Syntax: string htmlentities (string [, int quote_style [, string charset]) can convert all non-ASCII codes into corresponding entity codes.

Function: string strip_tags ()
Syntax: string strip_tags (string str [, string allowable_tags]) the parameter after the tag function for deleting HTML is the tag to be retained.


The above introduces the php string processing function (below), including the content, hope to be helpful to friends who are interested in the PHP Tutorial.

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.