亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

系統(tǒng)設(shè)計(jì)控制器的實(shí)現(xiàn)

Original 2019-04-19 08:16:18 188
abstract:<?phpnamespace app\admins\controller;use think\Controller;use Util\SysDb;class Setting extends Base{    public function index()    {        $data['item&#

<?php

namespace app\admins\controller;
use think\Controller;
use Util\SysDb;

class Setting extends Base
{
   public function index()
   {
       $data['item'] = $this->db->table('setting')->where(array('names'=>'site_setting'))->item();
       if($data['item']){
           $data['item']['values'] = json_decode($data['item']['values'],true);
           //把json格式變成數(shù)組
       }
       return $this->fetch('',$data);
   }
   public function save()
   {
       //接收什么數(shù)據(jù)
       $names = trim(input('post.names'));
       $data['values'] = json_encode(input('post.values'));

       //判斷是保存還是修改
       $item = $this->db->table('setting')->where(array('names'=>$names))->item();
       if($item){
           $this->db->table('setting')->where(array('names'=>$names))->update($data);
       }else{
           $data['names'] = $names;
           $this->db->table('setting')->insert($data);
       }
       exit(json_encode(array('code'=>0,'msg'=>'保存成功')));
   }
}

Correcting teacher:查無(wú)此人Correction time:2019-04-19 09:34:11
Teacher's summary:完成的不錯(cuò)。這個(gè)模塊,可以繼續(xù)增加功能。繼續(xù)加油。

Release Notes

Popular Entries