在哪个函数/类中,dbprefix 添加到 Codeigniter Active Record 请求中的表名中?
在 Codeigniter Active Record 请求中,dbprefix 添加到表名中的是哪个函数/类?
我需要根据表名动态更改前缀,但找不到在第一个中添加前缀的函数地方。
DB_active_rec.php 有一个 dbprefix() 函数,但这似乎没有效果。
In which function/class is the dbprefix added to the table name in Codeigniter Active Record requests?
I need to dynamically change the prefix based on the table name but cannot find the function which prepends the prefix in the first place.
DB_active_rec.php has a dbprefix() function but this appears to have no effect.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这取决于您使用的驱动程序,并且它也可能位于该驱动程序的几个位置。
尝试使用 DB_active_rec.php 文件的
set_dbprefix()
方法来覆盖它。这会变得非常混乱(跟踪您正在查询的表),我建议改为更改您的架构。It depends on the driver you're using, and it's probably in a few places in that driver too.
Try the DB_active_rec.php file's
set_dbprefix()
method to override it. This will get very messy (keeping track of which table you're querying), and I would recommend changing your schema instead.取自 codeigniter 网站 的一行
A line taken from the codeigniter site
在 application/config/database.php 中,您可以设置前缀变量。每当您使用 Active Records 时,都会添加前缀。
In application/config/database.php you can set a prefix variable. Anytime you use Active Records, the prefix is added.