我想用但不行,请帮助我。
$sql = Yii::$app->db("INSERT INTO posts(name) VALUES(:name)");
$sql->bindValues([':name' => 'John']);
$sql->execute();
答案 0 :(得分:0)
尝试创建命令excevert
Yii::$app->db->createCommand('INSERT INTO posts(name) VALUES(:name)')
->bindParam(':name' => 'John')->execute();