麻辣宝贝优酷,夜店北京插曲,春晓舞蹈
本文实例讲述了php过滤器 filter_has_var() 函数用法。分享给大家供大家参考,具体如下:
filter_has_var() 函数检查是否存在指定输入类型的变量。
如果成功则返回 true,如果失败则返回 false。
filter_has_var(type, variable)
例子:
<?php if(!filter_has_var(input_get, "name")) { echo("input type does not exist"); } else { echo("input type exists"); }
地址栏输入链接:
localhost://test.php?name=test
输出结果:
input type exists
使用此函数可以用来检查是否是get或post提交以及是否有cookie变量存在。
当然,你也可以使用 isset($_get["name"]) 进行判断
// please note that the function does not check the live array, // it actually checks the content received by php: $_get['name'] = 1; echo filter_input(input_get, 'name') ? 'yes' : 'no';
输出结果:
no
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
PHP date_default_timezone_set()设置时区操作实例分析
网友评论