$where=array();
if(strlen($state)==1){
$where['state']=$state;
}
$fm=Db::name('jiameng')->select();
为什么要用strlen?看下面$cast id = 0; var_dump(strlen($cast_id)); //1 var_dump(empty($cast_id)); // true var_dump(isset($cast id)); //true var_dump(is_null($cast id));//false $cast id ="" var_dump(strlen($cast_id)); //0 var_dump(empty($cast_id)); // true var_dump(isset($cast_id)); //true var dump(is null($cast id));//false