ntdba 发表于 2013-2-5 10:07:28

新手求教

本帖最后由 ntdba 于 2013-2-5 11:21 编辑


( ! ) Fatal error: Call to undefined method Test_m::insert() in D:\workspace\work\application\controllers\user.php on line 11
Call Stack
#TimeMemoryFunctionLocation
10.001781776{main}( )..\index.php:0
20.0048157192require_once( 'D:\workspace\work\system\core\CodeIgniter.php' )..\index.php:202
30.06121368312call_user_func_array ( )..\CodeIgniter.php:359
40.06121368312User->insert( )..\CodeIgniter.php:0

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User extends CI_Controller {
function insert()
{
$this->load->model("test_m");

$arr=array("uname"=>"u1","upass"=>"1234");

$this->test_m->insert($arr);
}
}

照视频教学,为什么出错啊?

ctoicqtao 发表于 2013-2-5 10:52:28

model的代码呢?贴出来看看

ntdba 发表于 2013-2-5 11:19:36

找到原因了,方法写错了,把$this->test_m->insert($arr);改成$this->test_m->user_insert($arr);

topwaybobo 发表于 2013-2-8 14:26:19

加载模型->再模型方法
页: [1]
查看完整版本: 新手求教