时间:2021-07-01 10:21:17 帮助过:15人阅读
//多级筛选
$name=$_GET[pid];
$brand=$_GET[theme];
$carage=$_GET[price];
echo $carage;
if($name="泵车" AND $brand="三一"){
$handmebuyinfo=M("handmebuyinfo");
$map['name']=$name;
$map['brand']=$brand;
//$map['carage']=$carage;
$row=$handmebuyinfo->where($map)->select();
dump($row);
}
if($name=='' OR $brand=='' OR $carage==''){
$handmebuyinfo=M("handmebuyinfo");
$map['name']=$name;
$map['brand']=$brand;
$map['carage']=$carage;
$map['_logic'] = 'OR';
$row=$handmebuyinfo->where($map)->select();
dump($row);
}
$a = array(
'a' => 1,
'b' => '',
'c' => 0,
);
print_r(array_diff($a, array('')));
print_r(array_diff($a, array('', 0)));
Array这样就不需要 if($name=='') 这样一个个判断了
(
[a] => 1
[c] => 0
)
Array
(
[a] => 1
)