系统模块练习

Original 2019-04-07 21:25:55 244
abstract:<?php /**  * Created by PhpStorm.  * User: Admin  * Date: 2019/4/7  * Time: 20:39  */ namespace app\admin\controller; use
<?php


namespace app\admin\controller;
use app\admin\controller\Common;
use think\Db;
use think\facade\Request;

class System extends Common
{
    public function index()
    {
        //获取数据
        $system=Db::table('system')->find();
        $this->view->system=$system;
        return $this->fetch();
    }
    public function edit()
    {
       $data=Request::param();
       var_dump($data);
       if(Db::table('system')->where('id',$data['id'])->update([
           'site_name'=>$data['site_name'],
           'about_title'=>$data['about_title'],
           'about_content'=>$data['about_content'],
           'pro_title'=>$data['pro_title'],
           'pro_content'=>$data['pro_content'],
           'xc_title'=>$data['xc_title'],
           'xc_content'=>$data['xc_content']
       ])){
           return ['res'=>1,'msg'=>'修改成功'];
       }else{
           return ['res'=>0,'msg'=>'修改失败'];
       }
    }
}


Correcting teacher:天蓬老师Correction time:2019-04-08 09:37:23
Teacher's summary:if(Db::table('system')->where('id',$data['id'])->update([ 'site_name'=>$data['site_name'], 'about_title'=>$data['about_title'], 'about_content'=>$data['

Release Notes

Popular Entries