如何使用isset()检查多个$ _POST变量是否存在? [英] how to check multiple $_POST variable for existence using isset()?
本文介绍了如何使用isset()检查多个$ _POST变量是否存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用单个语句isset检查$_POST
变量是否存在.
I need to check if $_POST
variables exist using single statement isset.
if (isset$_POST['name'] && isset$_POST['number'] && isset$_POST['address'] && etc ....)
有没有简单的方法可以做到这一点?
is there any easy way to achieve this?
推荐答案
$check_array = array('key1', 'key2', 'key3');
if (!array_diff($check_array, array_keys($_POST)))
echo 'all exists';
这篇关于如何使用isset()检查多个$ _POST变量是否存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文