1、实现model使用效果 2、自动加载model,KJ.PHP //自动加载文件 public static function _autoload($className){ switch ($classNa
//自动加载文件 public static function _autoload($className){ switch ($className){ //自动model类 case substr($className,-5)=='Model': $path= MODEL.'/'.$className.'.php'; if(is_file($path)) include $path; break; //自动加载控制器 case substr($className,-3)=='Crl': $path= CONTROLLER.'/'.$className.'.php'; if(is_file($path)) include $path; break; //自动加载基类 case substr($className,-4)=='Base': $path= KJ_CORE.'/base/'.$className.'.php'; if(is_file($path)) include $path; break; default : break; } }
public function __construct($table=null){ if($table){ $this->table=$table; } if(!$this->table){ die("no table" ); } $this->_connect(); $this->_opt(); }
where('id='.$id)->find(); }}
select(); var_dump($data); $data2=$model->findId(1); var_dump($data2); }}
来源地址:https://blog.csdn.net/weixin_39934453/article/details/132241663
--结束END--
本文标题: PHP最简单自定义自己的框架model使用(七)
本文链接: https://www.lsjlt.com/news/403361.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0