função PHP filter_has_var ()
Definição e Uso
filter_has_var () função verifica se o tipo de variável de entrada especificado existe.
Se bem sucedida, retorna TRUE, em caso de falha retorna FALSE.
gramática
filter_has_var(type, variable)
参数 | 描述 |
---|---|
type | 必需。规定要检查的类型。 可能的输入类型:
|
variable | 必需。规定要检查的变量。 |
Exemplos
Neste exemplo, o "nome" variável de entrada é enviado para a página PHP:
<?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");
}
?>
código de saída é o seguinte:
Input type exists
PHP completa Filtro de Referência