我经常使用以下代码来检查索引是否存在且不为空:
if(!(isset($_POST['service']) and $_POST['service']))
die('The service parameter is not available.');
这里我正在检查两个条件。是否可能使用单个内置函数来完成?例如:
if(!isSetAndNotNull($_POST['service']))
die('The service parameter is not available.');
$_POST
的值不能为null
,而且isset
已经检查了null
。你正在检查字符串是否为false
。 - deceze