1. TP6框架配置
2.数据库操作
2.1增(insert,insertall,insertgetid)
$arr = ['Cno' => 8,'Cname' => '数学','Cpno' => 7, 'Ccredit' => 10];
Db::table('course')->insert($arr);
$arr = [['Cno' => 9,'Cname' => '数学','Cpno' => 7, 'Ccredit' => 10],
['Cno' => 10,'Cname' => '数学','Cpno' => 2, 'Ccredit' => 10]
];
Db::table('course')->insertAll($arr);
$arr = ['Cno' => 11,'Cname' => '数学','Cpno' => 7, 'Ccredit' => 10];
$res = Db::table('course')->insertGetId($arr);
echo $res;
2.2删(delete)
$res = Db::table('course')->where('Cno',8)->delete();
2.3查(select,find)
查询一条数据
$res = Db::table('course')->where('Cno','2')->field('Cno')->find();
print_r($res);
查询多条数据
$res = Db::table('course')->where('Cno','2')->find();
print_r($res);
2.4改(update)
$res = Db::table('course')->where('Cno',8)->update($arr);