摘要:<?php /** * Created by PhpStorm. * User: Administrator * Date: 2019/3/2 * Time: 13:40 */ namespace app\admins\contro

<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/3/2
* Time: 13:40
*/
namespace app\admins\controller;
use app\admins\controller\Base;
class Site extends Base
{
public function index()
{
$siteInfo = $this->db->table('setting')->where(['names'=>'site_setting'])->item();
$siteInfo = json_decode($siteInfo['values'],true);
$this->assign('siteInfo',$siteInfo);
return $this->fetch();
}
public function save()
{
$names = trim(input('post.names'));
$data['values'] = json_encode(input('post.values'));
$siteInfo = $this->db->table('setting')->where(['names'=>$names])->item();
if($siteInfo){
$this->db->table('setting')->where(['names'=>$names])->update($data);
}else{
$data['names'] = $names;
$this->db->table('setting')->insert($data);
}
return ['code'=>0,'msg'=>'保存成功'];
}
}
批改老师:韦小宝批改时间:2019-03-12 09:28:33
老师总结:写的没毛病 你这后台的颜色搭配的有点不到位哦