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

企業(yè)站點(diǎn)——系統(tǒng)模塊

Original 2019-04-12 15:17:13 211
abstrakt:<?phpnamespace app\admin\controller;use app\admin\model\SystemModel;use think\facade\Request;use app\admin\controller\Common;class System extends Common{    public function index()  

<?php

namespace app\admin\controller;

use app\admin\model\SystemModel;
use think\facade\Request;
use app\admin\controller\Common;

class System extends Common
{
   public function index()
   {
       // 通過id為1來獲取網(wǎng)站需要修改的信息
       $data = SystemModel::get(1);
       // 將數(shù)據(jù)賦值到模板
       $this->view->system = $data;
       // 渲染系統(tǒng)設(shè)置模板
       return $this->fetch();
   }

   public function DoEdit()
   {
       // 獲取提交的數(shù)據(jù)
       $data = Request::param();
       // 實(shí)例化模型
       $system = new SystemModel();
       $info = $system->save([
           'site_name' => $data['site_name'],
           'about_title' => $data['about_title'],
           'about_content' => $data['about_content'],
           'ci_title' => $data['ci_title'],
           'ci_content' => $data['ci_content'],
           'cp_title' => $data['cp_title'],
           'cp_content' => $data['cp_content'],
       ], ['id' => 1]);
       if ($info) {
           return ['res' => 1, 'msg' => '保存成功!'];
       } else {
           return ['res' => 0, 'msg' => '保存失?。?#39;];
       }
   }
}

Korrigierender Lehrer:天蓬老師Korrekturzeit:2019-04-12 15:45:45
Zusammenfassung des Lehrers:save()的參數(shù)有點(diǎn)太多了, 這個(gè)數(shù)組,完全可以寫在外部, 然后再傳入, 以減少一行代碼的長度

Versionshinweise

Beliebte Eintr?ge