显示下拉菜单

filter_input()

« filter_id | filter_input_array »
<?php
? 
=
    
// array $data

$mixed filter_input (
    
?// int $type
    
// string $variable_name
    
?// [int $filter = FILTER_DEFAULT]
    
  // [mixed $options]
);

// note that filter_input() only uses the data passed to the script
// subsequent changes, as in this example, would actually be ignored
// filter_input() is emulated with filter_var() in this example

// see filter_var() for more examples including callbacks
?>
结果
$mixed = 'libgd&#60;script&#62;'
示例
#1 filter_input  (/* $predefined_var = $_GET */
 /* $data = ["search" => "libgd<script>"] */
 
INPUT_GET,
 
"search",
 
FILTER_SANITIZE_SPECIAL_CHARS)
#2 filter_input  (/* $predefined_var = $_GET */
 /* $data = ["search" => "libgd<script>"] */
 
INPUT_GET,
 
"search",
 
FILTER_SANITIZE_ENCODED)
#3 filter_input  (/* $predefined_var = $_POST */
 /* $data = ["number" => 3] */
 
INPUT_POST,
 
"number",
 
FILTER_CALLBACK,
 [
"options" => "cube"])
#4 filter_input  (/* $predefined_var = "xyz" */
 /* $data = ["number" => 3] */
 
INPUT_POST,
 
"number",
 
FILTER_CALLBACK,
 [
"options" => "cube"])
另请参阅
filter_input_array, filter_var, filter_var_array