Codeigniter 2.0无法扩展核心库
问题描述:
不知道是什么问题?我的类,它是在应用程序/核心文件夹,那就是:Codeigniter 2.0无法扩展核心库
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class MY_Image_lib extends CI_Image_lib {
public function __construct() {
parent::__construct();
}
function tesit($msg) {
log_message('error', $msg);
}
}
我得到这个错误:
致命错误:调用未定义的方法CI_Image_lib ::调用testIt()
当我像这样调用它:$ this-> image_lib-> testit('not working');
我失踪了,这太奇怪了。
答
只有以下类是核心类,所有其他类都应在库文件夹中进行扩展。
http://ellislab.com/codeigniter/user-guide/general/core_classes.html
Benchmark
Config
Controller
Exceptions
Hooks
Input
Language
Loader
Log
Output
Router
URI
Utf8
+0
哈哈,谢谢。我不知道,我错过了。谢谢。 – user147 2013-04-29 15:36:08
答
移动你的类应用程序/库文件夹,它会覆盖一个在当你调用它的系统文件夹。
为什么不使用*库*文件夹而不是核心? – 2013-04-27 23:55:54
@CanGeliş嗨,我不是CI大师,我已经开始学习它了,为什么要使用它?当核心文件夹?有什么不同?我不知道他们是不同的。谢谢。 – user147 2013-04-28 00:20:43
你不应该玩* core *那么多。 *库*文件夹是为您的目的而存在的。 http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html – 2013-04-28 14:35:47