PHP表单select中有0选项的处理
<div class="layui-inline">
<label class="layui-form-label">是否锁定</label>
<select class="layui-select" name="is_lock" id="is_lock">
<option value="">-请选择-</option>
<volist name="lock_id_name" id="vo">
<option value="{$vo.id}" <?php if($is_lock === $vo['id']){echo "selected";} ?>>{$vo.name}</option>
</volist>
</select>
</div>
if ($_GET['is_lock'] || $_GET['is_lock'] !== NULL) {
$where['is_lock'] = $_GET['is_lock'];
$this->assign('is_lock', (int)$_GET['is_lock']);
}
经过上面的恒等于处理!可以判断出0!
通过下面的不等于NULL,可以判断出空。