PHP character escape Function Summary. sometimes, for the sake of security, we need to escape the character strings entered by the user, which may be incorrect or obscure ~~~
Configurations and functions related to PHP string escaping are as
PHP character escape function summary (the escape string in php ). The article contains incorrect or ambiguous words. please point out ~~~ Configurations and functions related to PHP string escaping are as follows: 1.
SQL Server: SQL like wildcard special usage: Escape
%: Match zero or multiple arbitrary characters; _: match any single character; []: match a range; [^]: exclude a range
symbol
meaning
like '5 [%] '
In a string, some sequences have special meanings. These sequences start with a backslash ('\').Escape characters. MySQL recognizes the following escape sequence:
\ 0
ASCII 0 (NUL) characters.
\'
Single quotes (''').
Wildcard characters
Wildcards in SQL are used in place of one or more characters.
SQL wildcard characters are used with the LIKE operator.
Common wildcard characters in SQL Server
%
Matches an arbitrary length character (length can be 0)
If
SQLThe Escape Character of is: '(single quotes)
Example: Select * From TBL where uyear ='''06'
Note that the single quotation marks of the red background indicate escape characters. If we omit them, the entire statement will fail and the escape
I found the problem when I used SQL Server to query the table name starting with PRM _, check whether the underline is not escaped, I would like to summarize the T-SQL character escape
Create a temporary table and insert sample data
1 Create
A small trap for escape character "\", character escape trapI. Problem Introduction
I haven't used c # to connect to the database program for a long time. However, I found some information on the Internet and wrote it out. However, when I debug the
Specific methods
When the SQL where condition equals a string of special symbols, it is easy to make an error, cut off, not even execute, or cause the database to be dangerous.Let's simply test the followingCreating test data
The code
This paper introduces the character escaping functions and security functions commonly used in PHP, and uses these functions to filter the most common attack methods, such as SQL injection.Contents of this section: PHP Escape character function
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.