Home > Backend Development > PHP Tutorial > SQL security in my PHP learning

SQL security in my PHP learning

WBOY
Release: 2016-07-30 13:30:53
Original
985 people have browsed it

1. Dynamic monitoring query statements: is_numberic(), is_array, is_bool, is_double, is_string, is_object, is_integer, is_null check whether the expected data format!

2. Convert the data into the specified format: settype(): settype(string boog | integer | float | string | array | object | null, $variable);

3.sprintf() converts the elements in the string The semicolon is replaced with a variable passed as a parameter and formatted to the specified data type: sprintf("There are %u million cars in %s.",$number,$str)

Format: %b binary ;%s string; %o octal; %c ASCII; %% returns a percent sign; additional format value. Must be placed between % and letters (such as %.2f):

Use of placeholder: sprintf("With two decimal places: %1$.2f
Without decimals: %1$u" ,$number);

4. Add backslashes: addslashes,

Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces my PHP learning of SQL security, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template