Fatal error: Call to undefined method CI_DB_mysql_driver::inset() in Code Igniter

Fatal error: Call to undefined method CI_DB_mysql_driver::inset() in Code Igniter

致命错误:在第 12 行 \root\application\models\user_model.php 中调用未定义的方法 CI_DB_mysql_driver::inset()

user_model代码

<?php

 class User_model extends CI_Model
{
    public function __construct()
    {
        parent::__construct();
    }

public function create($email, $password)
{
    return $this->db->inset('user', [
        'email' => $email,
        'password' => $password

    ]);



}

public function delete()
{
    $this->db->where(['user_id' => $user_id]);
    return $this->db->delete('user');
}
}

admin.php代码

遇到了一个PHP错误

严重性:通知

消息:未定义索引:密码

文件名:controllers/admin.php

行号:14

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin extends CI_Controller {


public function index()
{
    $this->load->view('admin');
}

public function create_user()
{
    $this->load->model('user_model');
    echo $this->user_model->create($_POST['email'], $_POST['password']);
}

public function delete_user($user_id)
{
    $this->load->model('user_model');
    $this->user_model->delete($user_id);
}
}

请帮帮我

针对问题: 遇到 PHP 错误

严重性:通知

消息:未定义索引:密码

文件名:controllers/admin.php

行号:14

我已经尽力运行你在CI中的代码,但我找不到原因; 但是我注意到 "user_model.php" 中的代码在方法“$this->db->insert()”上。 参数应该是一个数组,所以请试试这个:

public function create($email, $password)
{
    return $this->db->inset('user', array(
        'email' => $email,
        'password' => $password,
        ),
    );
}

希望这有帮助;