PHP filter_has_var () function
Definition and Usage
filter_has_var () function checks whether the specified input variable type exists.
If successful it returns TRUE, on failure returns FALSE.
grammar
filter_has_var(type, variable)
参数 | 描述 |
---|---|
type | 必需。规定要检查的类型。 可能的输入类型:
|
variable | 必需。规定要检查的变量。 |
Examples
In this example, the input variable "name" is sent to the PHP page:
<?php
if(!filter_has_var(INPUT_GET, "name"))
{
echo("Input type does not exist");
}
else
{
echo("Input type exists");
}
?>
if(!filter_has_var(INPUT_GET, "name"))
{
echo("Input type does not exist");
}
else
{
echo("Input type exists");
}
?>
Output code is as follows:
Input type exists
Complete PHP Filter Reference