用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4306|回复: 1
收起左侧

[HELP] 数据库前缀问题

[复制链接]
发表于 2011-5-13 17:05:58 | 显示全部楼层 |阅读模式
本帖最后由 xuyao5 于 2011-5-13 17:06 编辑

在用户手册里面有这样的描述:(在这里
数据库表名Any tables that your add-on might use must use the 'exp_' prefix, followed by a prefix uniquely identifying you as the developer or company, and then a short descriptive table name. You do not need to be concerned about the database prefix being used on the user's installation, as CodeIgniter's database class will automatically convert 'exp_' to what is actually being used.
你的附加组件所用到的任何表都必须使用 'exp_' 这个前缀,然后是一个能够唯一标识开发者或公司的前缀,最后才是一个简短的描述性的表名。你不需要担心用户安装时所使用的数据库前缀,因为CodeIgniter的数据库类将根据实际情况自动地对 'exp_' 进行转换。
不当的:email_addresses  // 缺少这两个前缀pre_email_addresses // 缺少 exp_ 前缀exp_email_addresses // 缺少唯一前缀恰当的:exp_pre_email_addresses


另外在database配置文件中有
$db['default']['dbprefix'] = 'exp_';
$db['default']['swap_pre'] = '';


问题:
1)数据库前缀的目的是什么?
2)是不是只有在ActiveRecord里面才能使用这样的前缀?


发表于 2011-5-13 17:33:27 | 显示全部楼层
1)为了给数据加前缀
2)湿的

本版积分规则