多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
``` //原生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); ```