gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 07:44:30 24 4
gpt4 key购买 nike

我对 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com