初始提交
This commit is contained in:
26
fastphp/base/Model.php
Normal file
26
fastphp/base/Model.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user