【发布时间】:2013-08-06 08:53:20
【问题描述】:
我需要一些帮助来理解 CodeIgniter 的钩子逻辑,以使代码适应我的需要。
页面:https://www.codeigniter.com/user_guide/general/hooks.html
事实上,我不得不从这里修改 MySQL 的数据库驱动程序:
function _from_tables($tables)
{
if ( ! is_array($tables))
{
$tables = array($tables);
}
return '('.implode(', ', $tables).')';
}
到这里:
function _from_tables($tables)
{
if ( ! is_array($tables))
{
$tables = array($tables);
}
return implode(', ', $tables);
}
我使用 Active Record 库制作了这个 mod 以使用 UNION 查询。
有人可以帮我做一个钩子,以防止我更新核心系统时我的修改被覆盖吗?
提前致谢!
【问题讨论】:
-
我认为您正在寻找自定义库,而不是钩子。请参阅ellislab.com/codeigniter/user-guide/general/… -> 用您自己的版本替换库。您可以扩展 DB 驱动程序并用您自己的自定义版本替换一两个方法。
标签: php codeigniter hook