摘要:直接上代码【老师麻烦看到我提交的工单帮忙解答下吧】<?php namespace app\index\controller; use think\facade\Session; use think\facade\Request; use app\index\model\System as SystemMo; class S
直接上代码【老师麻烦看到我提交的工单帮忙解答下吧】
<?php
namespace app\index\controller;
use think\facade\Session;
use think\facade\Request;
use app\index\model\System as SystemMo;
class System extends Common
{
public function index()
{
$system = SystemMo::get(1);
$this->view->system = $system;
return view();
}
public function edit(SystemMo $systemmo)//直接上依赖注入省着new了
{
$data = Request::param();
$data['time'] = time();
$data['username'] = Session::get('name');
if($systemmo->save($data,['id'=>1]))
{
return ['res'=>1,'msg'=>'网站配置修改成功'];
}
return ['msg'=>'网站配置修改失败'];
}
}
批改老师:天蓬老师批改时间:2018-11-08 10:24:40
老师总结:作业写的不错,SystemMo代码没看到,最好一起贴出来