我在模型中有以下代码:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Membership_model extends CI_Model
{
function __construct()
{
parent::__construct();
}
public function register_user($info)
{
if(isset($info))
{
$data = array(
'fullname' => $info['fullname'] ,
'mobile' => $info['mobile'] ,
'telephone' => $info['home'] ,
'username' => $info['username'] ,
'password' => $info['password'] ,
'email' => $info['email'] ,
'member_type' => $info['memberType']
);
$this->db->insert('users', $data);
}
}
}
并在控制器中这样称呼它:
$info = array('fullname' => $fullname , 'mobile' => $mobile, 'home' => $home,
'username' => $username, 'password' => $password,
'memberType' => $memberType, 'email' => $email );
$this->membershipModel->register_user($info);
不过,我收到了这个错误:
遇到 PHP 错误
严重性:通知
消息:未定义的属性:Membership::$db
文件名:core/Model.php
行号:51
知道这意味着什么吗?问候,