Home  >  Article  >  Backend Development  >  php filter_has_var determines whether a variable exists function_PHP tutorial

php filter_has_var determines whether a variable exists function_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:00:311079browse

Definition and usage
The filter_has_var() function checks if a variable of the specified input type exists.

Returns TRUE or FALSE on success on failure.

Grammar

filter_has_var(type, variable)

	type
  • 必需的。指定类型检查可能存在的输入类型: INPUT_GET
  • INPUT_POST
  • INPUT_COOKIE
  • INPUT_SERVER
  • INPUT_ENV
variable 必需的。指定变量检查
  • Required. Specify type checking for possible input types: INPUT_GET
  • INPUT_POST
  • INPUT_COOKIE
  • INPUT_SERVER
  • INPUT_ENV
variable Required. Specify variable check


例如
在这个例子中的输入变量“名称”发送到PHP页面:

<!--?phpif(!filter_has_var(INPUT_GET, "name")) { echo("Input type does not exist"); }else { echo("Input type exists"); }?-->
输出为.
 Input type exists

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445506.htmlTechArticleDefinition and Usage The filter_has_var() function checks if a variable of the specified input type exists. Returns TRUE or FALSE on success on failure. Syntax filter_has_var(type, variable)...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn