本人借鉴其他PHP Framework 自己开发的一个Framework,请大家指点
本人借鉴其他php framework如autocrud等,还有ror的思想.?自己开发的一个framework
?
系统根据建好的数据库自动生成model、controller和view的各个文件:
?
本人是初学者,请大家多多指点
立即学习“PHP免费学习笔记(深入)”;
?
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:
?
没有您要查找的记录! 新增..
id
name
操作
{id}
{name}
删除 编辑 查看
?
?
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
C++高性能并发应用_C++如何开发性能关键应用
Java AI集成Deep Java Library_Java怎么集成AI模型部署
Golang后端API开发_Golang如何高效开发后端和API
Python异步并发改进_Python异步编程有哪些新改进
C++系统编程内存管理_C++系统编程怎么与Rust竞争内存安全
Java GraalVM原生镜像构建_Java怎么用GraalVM构建高效原生镜像
Python FastAPI异步API开发_Python怎么用FastAPI构建异步API
C++现代C++20/23/26特性_现代C++有哪些新标准特性如modules和coroutines
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号