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

系統的設置功能

Original 2019-04-09 16:07:02 356
abstract:<?phpnamespace app\admins\controller;use think\Controller;use Util\SysDb;class Setting extends Base{ // 網站設置 public function index(){ $data['item'] = $this->db->table('setting

<?php

namespace app\admins\controller;

use think\Controller;

use Util\SysDb;


class Setting extends Base{

// 網站設置

public function index(){

$data['item'] = $this->db->table('setting')->where(array('names'=>'site_setting'))->item();

if($data['item']){

$data['item']['values'] = json_decode($data['item']['values'],true);

}

return $this->fetch('',$data);

}


public function save(){

$names = trim(input('post.names'));

$data['values'] = json_encode(input('post.values'));


$item = $this->db->table('setting')->where(array('names'=>$names))->item();

if($item){

$this->db->table('setting')->where(array('names'=>$names))->update($data);

}else{

$data['names'] = $names;

$this->db->table('setting')->insert($data);

}

exit(json_encode(array('code'=>0,'msg'=>'保存成功')));

}

}


Correcting teacher:天蓬老師Correction time:2019-04-10 10:23:19
Teacher's summary:在ThinkPHP中, 后端的返回內容類型,默認就是json, 不必再轉換了

Release Notes

Popular Entries