💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
``` //原生sql语句查询 //$id='1 or 1=1'; //$sql='select * from ep_migrations where id=2 or 1=1'; //$results=Test::findBySql($sql)->asArray()->all(); ////:id占位符 防注入 //$sql='select * from ep_migrations where id=:id'; //$results=Test::findBySql($sql,[':id'=>'1 or 1=1'])->asArray()->all(); //数组方式组装条件 //$results=Test::find()->where(['id'=>2])->asArray()->all(); //id>2 //$results=Test::find()->where(['>','id',2])->asArray()->all(); //id>2并且id<5 //$results=Test::find()->where(['between','id',2,5])->asArray()->all(); //title like "%title%" //$results=Test::find()->where(['like','migration','2014'])->asArray()->all(); //print_r($results); //print_r(count($results)); //批量查询 foreach(Test::find()->batch(2) as $key=>$data){ foreach($data as $da){ echo '<pre>'; print_r($da['id']); } } // //$obj=Test::find(); //$data=$obj->asArray()->all(); ////var_dump($data); //print_r($data); ```