<?php
namespace app\admin\model;

use think\Model;

class Config extends Model
{
    public function saveConfig($data){
        if(empty($data) || !is_array($data)){
            return false;
        }
        foreach($data as $key => $value){
            if(empty($key)){
                continue; //结束本次循环
            }
            Config::where('varname',$key)->update(['value'=>trim($value)]);//更新
        }
        return true;
    }
}
