classes.php在yii运行的时候将被自动加载,位于yii2文件夹底下. <?php /** * Yii core class map. * * This file is automatically generated by the "build classmap" command under the "build" folder. * Do not modify it directly. * * @link http://www.yiiframewor…
$criteria = new CDbCriteria; $criteria->addCondition("id=1"); //查询条件,即where id = 1 $criteria->addInCondition(,,,,)); //代表where id IN (1,23,,4,5,); $criteria->addNotInCondition(,,,,));//与上面正好相法,是NOT IN $criteria->addCondition('id=1','…
一.一个sql拼装的情况 $criteria = new CDbCriteria; //函数方式 $criteria->addCondition("id=1"); //查询条件,即where id = 1 $criteria->addInCondition('id', array(1,2,3,4,5)); //代表where id IN (1,23,,4,5,); $criteria->addNotInCondition('id', array(1,2,3,4,5))…
$criteria = new CDbCriteria;$criteria->compare('name',$this->name,true,'OR'); //like部分匹配//$criteria->addCondition("id=1"); //查询条件,即where id = 1//$criteria->addInCondition('id', array(1,2,3,4,5)); //代表where id IN (1,2,3,4,5);$criteria…