多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 数组转数据库IN查询字符串 ``` // 数组转数据库IN查询字符串 function arrToInStr($array=[],$field,$type=0){ if($type){ $string = join(",",array_column($array,$field)); }else{ $string = "'".join("','",array_column($array,$field))."'"; } return $string; } ``` ``` # 例子: // 获取经销商地址 function getAgenAddressStr($agent_guid){ $area = Db::name("agent_area") ->where(['agent_guid'=>$agent_guid]) ->select(); $address = ""; if ($area){ foreach ($area as $k=>$v){ $address .= "'".$v['province'].",".$v['city'].",".$v['area']."',"; } $address = trim($address,","); } return $address; } ```