<div class="codetitle"><a style="CURSOR: pointer" data="30868" class="copybut" id="copybut30868" onclick="doCopy('code30868')"> 代码如下:<div class="codebody" id="code30868"> //生成where字符串 function get_where($arg = null) { foreach ((array)$arg as $key => $val) { if(is_int($key)) { $where .= " $val "; }else { if(is_string($val)) { if($val === null) { $where .= " and $key is null "; }else { $where .= " and $key = '$val' "; } }elseif(is_array($val)) { foreach ($val as $v) { if(is_string($v)) { $in .= $in ? ",'$v'" : "'$v'"; }else { $in .= $in ? ",$v" : "$v"; } } $where .= " and $key in ($in)"; }else { $where .= " and $key = $val "; } } } return $where; }
(编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|