PHP functions quite a lot, to complete each function is very understanding is a very challenging thing.Strip_tags,htmlspecialchars,htmlentities,stripslashes,addslashes These functions I think I need a special reinforcement.First function: Strip_tags,
1. Addslashes ()Addslashes () escapes special characters in SQL statements, including ('), ("), (), (NUL) four characters, which are used when the DBMS does not have its own escape function, but if the DBMS has its own escape function, it is
This article mainly introduces the security principle of using the addslashes function escape in PHP, and analyzes the usage of the addslashes function and the limitations of the ecshop user-defined function addslashes_deep, which is very useful,
Phpmysql_escape_string and addslashes. For details about the differences between phpmysql_escape_string and addslashes, refer to this article. The mysql_real_escape_string () function escapes special characters in strings used in SQL statements. For
PHP explanations of htmlspecialchars, strip_tags, and addslashes. Htmlspecialchars, strip_tags, and addslashes of PHP are common functions in Web application development. today we will detail the usage of these functions: 1. strip_tags:
Addslashes () function definition and usage The addslashes () function adds a backslash before the specified predefined character. The predefined characters are:
Single quotes (')
Double quotation marks (")
Backslash (\)
If you look at the code below, can you find out where the error is?
Copy Code code as follows:
echo function_exists (' addcslashes ');//detect if the function exists
Echo GET_MAGIC_QUOTES_GPC (). ' '//detect whether to turn on
This article describes the Addslashes () and stripslashes () implementation string escape and restore usage in PHP. Share to everyone for your reference, specific as follows:
The addslashes () function in PHP returns a string that adds a backslash
int get_magic_quotes_gpc (void)
This function obtains the PHP environment set Variable MAGIC_QUOTES_GPC (GPC, Get/post/cookie) value. Return 0 To turn off this feature; return 1 indicates this feature is turned on. When MAGIC_QUOTES_GPC is turned on,
This article illustrates the addslashes function and SQL injection in PHP. Share to everyone for your reference. The specific analysis is as follows:
Addslashes can automatically give single quotes, double quotes add \\\\\\, so we can safely put
0x00:php built-in filter functionPHP has built-in functions to defend against attacks and simply introduces several functions.Magic QuotesWhen turned on, all ' (single quotes), "(double quotes), \ (backslash), and NULL characters are automatically
This article describes how to explain htmlspecialchars, strip_tags, and addslashes in PHP. For more information, see htmlspecialchars, strip_tags, and addslashes in PHP, today we will detail the usage of these functions:
1. function strip_tags:
Definition and usage
The Addslashes () function adds a backslash before the specified predefined character.
These predefined characters are:Single quotation mark (') Double quotation mark (") backslash (\) NULL syntax
Addslashes (String)Hints and
Definition and usage
The addslashes () function adds a backslash before the specified predefined character.
The predefined characters are:
Single quotes (')
Double quotation marks (")
Backslash (/)
Null
Syntax
Addslashes (string)
PHP Backslash handler function
Addslashes (): Adds a backslash to some predefined characters in the input string so that the processing is required for database query statements, and so on. These predefined characters are: Single quotes ('), double
The Addslashes () function returns a string that adds a backslash before a predefined character.The predefined characters are:
Single quotation mark (')
Double quotation marks (")
Back slash (\)
Null
Echo "Who's Bill Gates?"
Htmlspecialchars, Strip_tags, addslashes functions are the most common in the development of web-based programs, and this article will introduce these three functions separately.
1.strip_tags () function
The Strip_tags () function strips HTML, XML,
For details about the differences between phpmysql_escape_string and addslashes, refer to this article. The mysql_real_escape_string () function escapes special characters in strings used in SQL statements. The following characters are affected:
For details about the differences between phpmysql_escape_string and addslashes, refer to this article. the mysql_real_escape_string () function escapes the strings used in the SQL statement... for details about the differences between php
Difference between the PHP function addslashes and mysql_real_escape_string
Create table users (
Username VARCHAR (32) character set gbk,
Password VARCHAR (32) character set gbk,
Primary key (username)
);
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.