系统设置模板的更新操作

Original 2019-03-30 12:34:38 268
abstract:public function edit()    {        // 获取提交的数据        $data = Request::param();        // 实例化模型        $system

public function edit()
   {
       // 获取提交的数据
       $data = Request::param();
       // 实例化模型
       $system = new SystemModel();
       $info = $system->save([
//            更新的数据
           'site_name' => $data['site_name'],
           'about_title' => $data['about_title'],
         
       ],条件 );
//        判断是否更新成功给前台返回值
       if ($info) {
           return ['res' => 1, 'msg' => '保存成功!'];
       } else {
           return ['res' => 0, 'msg' => '保存失败!'];
       }

Correcting teacher:天蓬老师Correction time:2019-03-30 13:43:32
Teacher's summary:控制器中的方法, 最常用的操作就是从模型获取数据,并用视图输出

Release Notes

Popular Entries