返回系统模板渲染,......登陆

系统模板渲染,修改更新

靖哥哥2019-05-28 21:39:43235
<?php
namespace app\admin\controller;
use app\admin\controller\Common;
use app\admin\model\SystemModel;
use think\facade\Request;
use think\facade\Session;

class System extends Common
{
public function index()
{
// 首页查询出数据
$res = SystemModel::all();
foreach($res as $val){
// 模板赋值
$this->view->assign('system',$val);
}
// 模板渲染
return $this->view->fetch();
}
public function edit()
{
// 系统更新
$data = Request::param();
$datas = [
'site_name' => $data['site_name'],
'about_title' => $data['about_title'],
'about_content' => $data['about_content'],
'com_int_title' => $data['com_int_title'],
'com_int_content' => $data['com_int_content'],
'com_x_title' => $data['com_x_title'],
'com_x_cont' => $data['com_x_cont'],
'time' => time(),
'username' => Session::get('username')
];
$res = SystemModel::where('id',1)->update($datas);
if($res){
return ['status' => 1,'msg' => '修改成功~~'];
}else{
return ['status' => 0,'msg' => '修改失败!'];
}
}
}


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送