Php filter_input_array filter illegal information

Source: Internet
Author: User

 

Definition and usage
The filter_input_array () function gets multiple filters from external input scripts and filters them.

This function is useful for filtering a large number of input variables without requiring filter_input (), many.

You can enter several sources for this feature:

INPUT_GET
INPUT_POST
INPUT_COOKIE
INPUT_ENV
INPUT_SERVER
INPUT_SESSION (not implemented yet)
INPUT_REQUEST (not implemented yet)
Returns an array of successfully filtered data, which is false.

Syntax

filter_input(input_type, args)
 

Input_type: required. Specifies the input type. See the list of possible types (args): Optional. Specifies the arguments for a series of filters.

The key to a series of valid values is a variable name and a valid value. It is a filter ID or an array that specifies the filter, flag, and selection. This parameter can also be a single filter number. If so, all values in the input array filter the specified filter number can be a number name (such as FILTER_VALIDATE_EMAIL) or ID Number (such as 274)

 

Tips and instructions: Check the PHP filter for reference filters.

 

For example, in this example, we use the filter_input_array () function to filter the last three variables.

 

The variable after receiving the message is a name, age and e-mail address:

 

 array  (  "filter"=>FILTER_CALLBACK,  "flags"=>FILTER_FORCE_ARRAY,  "options"=>"ucwords"  ), "age" => array  (  "filter"=>FILTER_VALIDATE_INT,  "options"=>array   (   "min_range"=>1,   "max_range"=>120   )  ), "email"=> FILTER_VALIDATE_EMAIL, );print_r(filter_input_array(INPUT_POST, $filters));?>
 
Return Value diligence.
 
 
Array ( [name] => Peter [age] => 41 [email] => peter@example.com )

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.