1.add()是记录单条插入
1 // 添加一条数据 2 $User = M("User"); // 实例化User对象 3 $data['name'] = 'ThinkPHP'; 4 $data['email'] = 'ThinkPHP@gmail.com'; 5 $User->add($data);
2.addAll()是记录批量插入
1 // 批量添加数据 2 $dataList[] = array('name'=>'thinkphp','email'=>'thinkphp@gamil.com'); 3 $dataList[] = array('name'=>'onethink','email'=>'onethink@gamil.com'); 4 $User->addAll($dataList);