DQFrameworkPHP輕量級框架
DQ PHP Framework是一個輕量級為開發(fā)而開發(fā)的PHP框架,歡迎吐槽
DQ PHP Framework 基于MVC架構(gòu)
使用前請確定你的Apache服務(wù)器或者Nginx服務(wù)器 打開PHP PathInfo并且隱藏index.php
/config.php里配置PDO MySQL實現(xiàn)數(shù)據(jù)庫連接
/res/config.xml設(shè)置項目名稱 項目目錄 項目控制器 項目動作 (自動生成)
1.使用全局模型I(resource,Node); 取res資源文件下的xml配置文件 例如新建一個menu.xml資源文件 取其中的節(jié)點active
利用I("menu","active"); 系統(tǒng)自行映射到menu.xml下的active子節(jié)點
2.控制器繼承類M實現(xiàn)模板 模板使用的是smarty的模板機(jī)制,使用標(biāo)簽為<{}> $this->assign(variable,value); $this->display(templetes); $this->display(templetes,folder); 模板存放在項目文件夾下的View文件夾里 一般不存在制定文件夾便設(shè)置為公用文件夾Public里邊,設(shè)置文件夾就在View下自行新建一個文件夾即可 3.控制器繼承類M繼承數(shù)據(jù)模型 Select select($table, $columns, $where) table [string] 表的名稱. columns [string/array] 返回的字段列. where (optional) [array] WHERE 條件語句. 返回值: [array] 查詢到的數(shù)組
Insert insert($table, $data) table [string] 表名. data [array] 插入到表里的數(shù)據(jù). Return: [number] 返回插入的id
Update update($table, $data, $where) table [string] 表名. data [array] 修改的數(shù)據(jù). where (optional) [array] WHERE 條件. Return: [number] 受影響的行數(shù).
Delete delete($table, $where) table [string] 表名. where [array] WHERE 刪除條件. Return: [number] 返回被刪除的行數(shù).
Get get($table, $columns, $where) table [string] 表名. columns [string/array] 返回的字段列. where (optional) [array] WHERE 條件. Return: [string/array] 返回查詢到的數(shù)據(jù).
Has has($table, $where) table [string] 表名. where [array] WHERE 條件. Return: [bool] 返回 TRUE 或者 FALSE.
Count count($table, $where) table [string] 表名. where (optional) [array] WHERE 條件. Return: [number] 行的數(shù)量.
Max max($table, $column, $where) table [string] 表名. column [string] 查詢的字段列. where (optional) [array] WHERE 條件. Return: [number] 返回最大的值.
Min min($table, $column, $where) table [string] 表名. column [string] 需要查詢的列. where (optional) [array] WHERE 條件. Return: [number] 返回最小的值.
Avg avg($table, $column, $where) table [string] 表名. column [string] 列字段 where (optional) [array] WHERE 條件. Return: [number] 平均值.
4.繼承Boostrap和jquery方便制作網(wǎng)站 res/js res/style
5.動作內(nèi)調(diào)用項目模型Applications/項目/Model/名字.class.php $this->LoadModule(名字); $this->instances(類名)->功能;
6.后續(xù)拓展性例如分頁類、登陸類、以及各方面的類還在完善 等待2.0出現(xiàn)吧
