PHP filter_has_var() 函数
定义和用法
filter_has_var() 函数检查是否存在指定输入类型的变量。
若成功,则返回 true,否则返回 false。
语法
filter_has_var(type, variable)
| 参数 | 描述 | 
|---|---|
| type | 必需。规定要检查的类型。可能的值: 
 | 
| variable | 必需。规定要检查的变量。 | 
例子
在本例中,输入变量 "name" 被发送到 PHP 页面:
<?php
if(!filter_has_var(INPUT_GET, "name"))
 {
 echo("Input type does not exist");
 }
else
 {
 echo("Input type exists");
 }
?>
输出类似:
Input type exists
