php - CodeIgniter、Active Record 还是查询生成器?

标签 php mysql database codeigniter activerecord

我对 CI 中的 Active Record(AR) 没有什么困惑,因为我在 Ruby On Rails 中比较了它,根据 Rails 指南,Active Record 意味着

the layer of the system responsible for representing business data and logic. Active Record facilitates the creation and use of business objects whose data requires persistent storage to a database. It is an implementation of the Active Record pattern which itself is a description of an Object Relational Mapping system.

例如 CI 中的 AR

$query = $this->db->get('mytable');

它看起来更像查询生成器而不是 AR,请解释一下,因为我几周前才开始使用 CI。

最佳答案

Codeigniter 事件记录

CodeIgniter 使用 Active Record 数据库模式的修改版本。此模式允许使用最少的脚本在数据库中检索、插入和更新信息。在某些情况下,只需一两行代码即可执行数据库操作。 CodeIgniter 不要求每个数据库表都有自己的类文件。相反,它提供了一个更简化的界面。

Refer this

变更日志版本 3.0.0:(2015 年 3 月 30 日)

Renamed the Active Record class to Query Builder to remove confusion with the Active Record design pattern.

关于php - CodeIgniter、Active Record 还是查询生成器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28229291/

相关文章:

mysql - PostgreSQL 还是 MySQL 更受 Node.js 欢迎?

sql - 只有 ID 的表和许多联结表

php - Googlebot 无法解释的 32 字符十六进制附加字符串导致每天超过 20,000 个 404 错误

php - 如何使用 PHP+mySQL 从 XML 中获取所有节点?

php - 基于帐户信息的单个客户端页面上的 Wordpress 错误消息

mysql - 无法链接 Jenkins 管道中的两个 "sidecar"容器

database - 主键与唯一约束?

database - java.sql.SQLException : [Microsoft][ODBC Microsoft Access Driver] Too few parameters 异常

php - 如何在 CodeIgniter PHP 应用程序中加快图像大小调整?

php - 使用下拉菜单从 MySQL 提取和发布数据