初始提交

This commit is contained in:
wanyongkang
2020-10-03 17:23:32 +08:00
commit a331e3f1d5
11 changed files with 676 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace fastphp\base;
/**
* 控制器基类
* Class Controller
* @package fastphp\base
*/
class Controller
{
protected $_controller;
protected $_action;
// protected $_view;
//初始化属性,实例化对应模型
public function __construct($controller,$action)
{
$this->_controller = $controller;
$this->_action = $action;
// $this->_view = new View($controller,$action);
}
// //分配变量
// public function assign($name,$value){
// $this->_view->assign($name,$value);
// }
//
// //渲染视图
// public function render(){
// $this->_view->render();
// }
}

26
fastphp/base/Model.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
namespace fastphp\base;
use fastphp\db\Sql;
class Model extends Sql
{
protected $model;
public function __construct()
{
//获取数据库表名
if(!$this->table){
//获取模型类名称
$this->model = get_class($this);
//删除模型名最后的model
$this->model = substr($this->model,0,-5);
//数据库表名与类名一致
$this->table = strtolower($this->model);
}
}
}