symantecpcanywhere php SQL之where语句生成器
程序员文章站
2022-03-31 16:52:59
...
复制代码 代码如下:
//生成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;
}
以上就介绍了symantecpcanywhere php SQL之where语句生成器,包括了symantecpcanywhere方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
上一篇: .off格式文件
下一篇: NodeJS父进程与子进程资源共享详解