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