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

系統(tǒng)的設置功能

オリジナル 2019-04-09 16:07:02 356
サマリー:<?phpnamespace app\admins\controller;use think\Controller;use Util\SysDb;class Setting extends Base{ // 網(wǎng)站設置 public function index(){ $data['item'] = $this->db->table('setting

<?php

namespace app\admins\controller;

use think\Controller;

use Util\SysDb;


class Setting extends Base{

// 網(wǎng)站設置

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'=>'保存成功')));

}

}


添削の先生:天蓬老師添削時間:2019-04-10 10:23:19
先生のまとめ:在ThinkPHP中, 后端的返回內(nèi)容類型,默認就是json, 不必再轉換了

手記を発表する

人気のある見出し語