# Insert 插入数据 > insert($data) 中文 : 插入($data) data [array] 插入到表里的数据 Return: [number] 返回插入的id ~~~ <?php namespace Action; use HY\Action; class Index extends Action { public function Index(){ //实例User表为对象 $User = M("User"); $User->insert(array( "user" => "admin", "pass" => "admin", )); //返回插入的ID $User->id(); //中文语法 $User->插入(array( "user" => "admin", "pass" => "admin", )); } } ~~~ ## 插入多条数据 ~~~ <?php namespace Action; use HY\Action; class Index extends Action { public function Index(){ //实例User表为对象 $User = M("User"); $id = $User->insert(array( array( "user" => "admin", "pass" => "admin", ), array( "user" => "admin1", "pass" => "admin1", ) )); } } ~~~