PHP filter_has_var() 函数

PHP 教程 · 2019-01-25 17:42:20

定义和用法

filter_has_var() 函数检查是否存在指定输入类型的变量。

如果成功则返回 TRUE,如果失败则返回 FALSE。

语法


filter_has_var(type, variable)


参数 描述
type 必需。规定要检查的类型。

可能的输入类型:

  • INPUT_GET
  • INPUT_POST
  • INPUT_COOKIE
  • INPUT_SERVER
  • INPUT_ENV
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


点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

The Linux Programming Interface

The Linux Programming Interface

Michael Kerrisk / No Starch Press / 2010-11-6 / GBP 79.99

The Linux Programming Interface describes the Linux API (application programming interface)-the system calls, library functions, and other low-level interfaces that are used, directly or indirectly, b......一起来看看 《The Linux Programming Interface》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具