根据指定的key,将二维数组的value转换为string,适用于mysql的in查询

function array_unique_join($arr,$param){
        $utm_source_arr = array_unique(array_column($arr,$param));
        if(count($utm_source_arr) > 1){
            $a = implode('\',\'',$utm_source_arr);
            $utm_source = "'$a'";
        }else{
            if(empty($utm_source_arr[0])){
                $utm_source_arr[0] = '';
            }
            $utm_source = "'$utm_source_arr[0]'";
        }
        return $utm_source;
    }

  

posted @ 2019-03-01 15:32  谦逊的铅笔  阅读(360)  评论(0编辑  收藏  举报