PHP学院的中学生 2022-01-18 13:46:23 1486次浏览 0条回复 0 0 0
namespace app\controller;
use app\models\User;
 
public function actionIndex()
{
    $request = \Yii::$app->request;
    $id = $request->get('id');
    $sql = 'select * from user where id=:id';
 
    $res = User::findBySql($sql,[':id' => $id])->all();
 
    return $this->render('index'); 
}

$query = Yii::$app->db->createCommand('select * from users where id=:id AND state=:state')
    ->bindValue(':id',$_GET['id'])
    ->bindValue(':state',1)
    ->queryOne();

    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册