Code Igniter Model出现意外错误

时间:2014-11-29 06:52:15

标签: codeigniter model

这是我的控制者:

class Test extends CI_Controller {
    public function insert1(){
        $this->load->model("test1");

        $newRow = ["name" => "bob",
            "id" => 123 ,
            ];

        $this->test1->insert_entry($newRow);
     }
}

我的模型有这个代码:

class Test1 extends CI_Model {

    function insert_entry($array){   

        $this->db->insert("TEST",$array);​
    }
}

它给了我这个错误:

Parse error: syntax error, unexpected '}' in C:\wamp\www\ilink-site\application\models\test1.php on line 8

2 个答案:

答案 0 :(得分:0)

在该行"id" => 123 ,

之后的123之后删除逗号

答案 1 :(得分:0)

有数组定义。 $ array = array(' key' =>' value');

class Test extends CI_Controller { public function insert1(){ $this->load->model("test1"); $newRow = array("name" => "bob", "id" => 123); $this->test1->insert_entry($newRow); } }

相关问题