Introduction to PHP Tutorial Filter
PHP filters are used to validate and filter data from non-secure sources, such as user input.
Installation
The filter function is part of the PHP core. These functions can be used without installation.
PHP Filter function
php: Indicates the earliest version of PHP that supports this function.
| function |
Description |
PHP |
| Filter_has_var () |
Checks whether a variable of the specified input type exists. |
5 |
| FILTER_ID () |
Returns the ID number of the specified filter. |
5 |
| Filter_input () |
Get input from outside the script and filter it. |
5 |
| Filter_input_array () |
Get multiple inputs from outside the script and filter them. |
5 |
| Filter_list () |
Returns an array that contains all the supported filters. |
5 |
| Filter_var_array () |
Gets a multi-item variable and filters it. |
5 |
| Filter_var () |
Gets a variable and filters it. |
5 |
PHP Filters
| ID Name |
Description |
| Filter_callback |
Invokes a user-defined function to filter the data. |
| Filter_sanitize_string |
Remove tags, remove or encode special characters. |
| filter_sanitize_stripped |
The alias of the "string" filter. |
| filter_sanitize_encoded |
Url-encode string that removes or encodes special characters. |
| Filter_sanitize_special_chars |
The HTML escape character ' "<>& and the ASCII value less than 32 characters. |
| Filter_sanitize_email |
Remove all characters except letters, numbers, and!#$%& ' *+-/=?^_ ' {|} ~@. [] |
| Filter_sanitize_url |
Delete all characters except letters, numbers, and $-_.+!* ' (), {}|^~[] ' <>#% ';/?:@&= |
| Filter_sanitize_number_int |
Remove all characters except numbers and +- |
| Filter_sanitize_number_float |
Remove all characters except numbers, +-and., EE. |
| Filter_sanitize_magic_quotes |
Apply Addslashes (). |
| Filter_unsafe_raw |
Do not filter, remove or encode special characters. |
| Filter_validate_int |
Validates the value with an integer in the specified range. |
| Filter_validate_boolean |
Returns True if "1", "true", "on" and "Yes", and returns False if it is "0", "false", "off", "No", and "". Otherwise, NULL is returned. |
| Filter_validate_float |
Validates the value with a floating-point number. |
| Filter_validate_regexp |
Based on RegExp, Perl-compatible regular expressions are validated for values. |
| Filter_validate_url |
Verify the value as a URL. |
| Filter_validate_email |
Verify the value as an e-mail. |
| Filter_validate_ip |
Verify the value as an IP address. |
http://www.bkjia.com/PHPjc/445380.html www.bkjia.com true http://www.bkjia.com/PHPjc/445380.html techarticle PHP Tutorial Filter Introduction PHP filters are used to validate and filter data from non-secure sources, such as user input. Installing the filter function is part of the PHP core. No need to ...