• 用PHP脚本来拆分字符串并形成两个新字段


    //控制器中
    $kindlist
    = $this->kindgarten->getKindgartenList(); foreach($kindlist as $key=>$val) { $arr = explode(",",$val['kgPosition']); $updateArr = array( 'Lng'=>$arr[1], 'Lat'=>$arr[0] ); $this->kindgarten->addGarten($updateArr , $val['kgId']); }

    model中

    /**
         * @return mixed
         */
        public function getKindgartenList()
        {
            $query = $this->db->get($this->table)->result_array();
            return $query;
        }
    
        /**
         * 幼儿园数据入库
         * */
        public function addGarten($gartenData,$kgId){
    
            if(empty($kgId))
            {
                $gartenData['changeTime'] = time().'000';
                $this->db->insert($this->table,$gartenData);
                return $this->db->insert_id();
            }
            else
            {
                return $this->db->update($this->table,$gartenData,array('kgId'=>$kgId));
            }
        }
  • 相关阅读:
    typescript 箭头表达式
    typescript 参数类型
    ts介绍
    pm2
    koa2安装
    linux 搭建ftp
    CENTOS6.5 安装 mysql5.6 以及搭建双主
    bzoj 3043 (差分序列运用)
    poj 3277 City Horizon
    NOI2015 程序自动分析
  • 原文地址:https://www.cnblogs.com/g825482785/p/substr.html
Copyright © 2020-2023  润新知