Php 使用wanwizard datamapper时调用codeginiter帮助文件中的模型类对象

Php 使用wanwizard datamapper时调用codeginiter帮助文件中的模型类对象,php,mysql,codeigniter-2,datamapper,Php,Mysql,Codeigniter 2,Datamapper,尝试从codeigniter帮助文件访问用户类对象时,未找到其抛出错误,如类“user”。我的代码类似于 $u=新用户(); $u->get() 我可以在库文件中使用,但不能在帮助文件中使用。谁能帮帮我吗 要在助手中使用模型,您必须: // Get a reference to the controller object $CI = get_instance(); // You may need to load the model if it hasn't been pre-loaded $C

尝试从codeigniter帮助文件访问用户类对象时,未找到其抛出错误,如
类“user”
。我的代码类似于
$u=新用户();
$u->get()

我可以在库文件中使用,但不能在帮助文件中使用。谁能帮帮我吗

要在助手中使用模型,您必须:

// Get a reference to the controller object
$CI = get_instance();

// You may need to load the model if it hasn't been pre-loaded
$CI->load->model('User');

// Call a function of the model
$CI->User->get();

希望这会有帮助

对不起,这个力帮不了我