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

系統(tǒng)模塊控制器

asal 2019-06-19 17:03:22 181
abstrak:<?phpnamespace app\admin\controller;//use think\facade\View;  //view創(chuàng)建靜態(tài)代理use app\admin\model\SystemModel;use think\Controller;use app\admin\controller\Common;//訪問入口use think\facade\Request;//

<?php
namespace app\admin\controller;
//use think\facade\View;  //view創(chuàng)建靜態(tài)代理
use app\admin\model\SystemModel;
use think\Controller;
use app\admin\controller\Common;//訪問入口
use think\facade\Request;//系統(tǒng)控制器
use think\facade\Session;//系統(tǒng)緩存

class System extends Common
{
    public function index()
    { 
     //獲取網(wǎng)站原始信息
     $data = SystemModel::get(1);
     //給模板賦值
     $this->view->system = $data;
     //渲染管理員界面
        return $this->fetch();
    }

    public function DoEdit()
    {
     //獲取提交的數(shù)據(jù)
     $data = Request::param();
     //實例化模型
     $system = new SystemModel();
     //修改數(shù)據(jù)
     $info = $system->save([
      'site_name'=>$data['site_name'],
      'about_title'=>$data['about_title'],
      'about_content'=>$data['about_content'],
      'desc_title'=>$data['desc_title'],
      'desc_content'=>$data['desc_content'],
      'publicity_title'=>$data['publicity_title'],
      'publicity_content'=>$data['publicity_content']
     ],['id'=>1]);
     if($info){
      return['res'=>1,'msg'=>'保存成功!'];
     }else{
      return['res'=>0,'msg'=>'保存失敗!'];
     }
    }

}


Guru membetulkan:查無此人Masa pembetulan:2019-06-20 09:49:40
Rumusan guru:完成的不錯。如果$data可以直接使用,就不要在賦值了。繼續(xù)加油。

Nota Keluaran

Penyertaan Popular