Home  >  Article  >  Backend Development  >  本人龟鉴其他PHP Framework 自己开发的一个Framework,请大家指点

本人龟鉴其他PHP Framework 自己开发的一个Framework,请大家指点

WBOY
WBOYOriginal
2016-06-13 13:08:37776browse

本人借鉴其他PHP Framework 自己开发的一个Framework,请大家指点

本人借鉴其他PHP Framework如autocrud等,还有ror的思想.?自己开发的一个Framework

?

系统根据建好的数据库自动生成model、controller和view的各个文件:

?

本人是初学者,请大家多多指点

?

Model:

?

include "connect.php";
class users extends Connect{??
?function Add($data){
??$this->crud->users->insert($data);
?}
?function Select($orderby,$where,$currentpage,$paging){
??$this->crud->users->orderby = "$orderby";
??$this->crud->users->where = "$where";
??$paging==1 ? $this->crud->users->paging = true : $this->crud->users->paging = false;
??$this->crud->users->perpage = 2;
??$this->crud->users->currentpage = $currentpage;
??return $this->crud->users->select();
?}
?function Get($id){
??return $this->crud->users->get($id);
?}
?function Delete($id){
??return $this->crud->users->delete($id);
?}
?function Update($data,$id){
??return $this->crud->users->update($data, $id);
?}
}
?>

?

?

controller:

?

include ('models/users.php');
include ('smarty/template.php');
$tpl = new SmartTemplate("views/listusers.htm");
$users = new users;
$orderby = "";
$where = "";
$currentpage = $_GET['page'];
$userss = $users->Select($orderby,$where,$currentpage,0);
$rows = count($userss);
$userss = $users->Select($orderby,$where,$currentpage,1);
$i = 0;
if($rows > 0){
??? for($j = 0; $j ???? $i = 1-$i;
???? ($i==0) ? $bgcolor="#eff1f3" : $bgcolor="#feefd5";
???? $userss[$j][bgcolor] = $bgcolor;
?}
}
$tpl->assign(array(
"userss"=>$userss,
"rows"=>$rows));
$tpl->output();
?>

?

view:

?






没有您要查找的记录! 新增..


共 {rows} 条记录 转到第  页
  新增..






id name 操作
{id} {name} 删除 编辑 查看



?

?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn