今天終於把整個後臺管理系統弄好了,其實沒什麼難點,只是做爲一個Thinphp學習的練手項目,這個項目,如今還只能算是作了一半,還有前臺展現方面的功能沒有完成。先過一遍後臺的功能吧!php
一、首頁git
二、菜單管理github
三、推薦位管理web
四、推薦位內容管理數據庫
五、用戶管理json
六、基本管理編輯器
功能就以上的那麼幾個了,不是什麼大系統,練手項目。在ThinkPHP 遇到一些小坑,好比自定義的Model沒有進行到數據庫操做就不要 集成ThinkPHP 的 Model 類,集成了Model類它默認人會調用數據庫的,可是數據庫中又沒這個表,從而會致使異常。就相似於我學習
個人這個基礎管理功能。this
這個是基礎管理的控制器類spa
<?php namespace Admin\Controller; use Think\Controller; class BasicController extends CommonController { public function index() { $result=D('Basic')->select(); $this->assign('vo', $result); $this->assign('type', 1); $this->display(); } public function add() { if ($_POST) { if (!$_POST['title']) { return jsonResult(0, '站點信息不能爲空'); } if (!$_POST['keywords']) { return jsonResult(0, '站點關鍵詞不能爲空'); } if (!$_POST['description']) { return jsonResult(0, '站點描述不能爲空'); } D('Basic')->save($_POST); } else { return jsonResult(0, '沒有提交的數據'); } return jsonResult(1, '配置成功!'); } public function cache() { $this->assign('type', 2); $this->display(); } }
這個是基礎管理Model類,沒有繼續數據庫操做就不用集成Model
<?php namespace Common\Model; class BasicModel { public function save($data=array()){ if(!$data){ throw_exception('沒有提交的數據'); } $id=F('basic_web_config',$data); } public function select(){ return F('basic_web_config'); } } ?>
這個後臺開發主要涉及的知識點是 Thinphp,和Thinkphp的內置插件的使用還有KindEditor富文本編輯器的使用。接下來的計劃就是繼續進行前臺頁面的開發!
源碼地址:https://github.com/YoZiLin/TP-CMS