分批查询
foreach (ForbiddenWordsTongtu::find()->each() as $tongTu) {// coding}
/gii报错
Invalid Configuration
可能的原因是 web/asset/ 目录没有写权限
常用写法
// and (xx or xx)写法$obj->andWhere(['or',['id' => $param['company_name']],['like', 'company_name', $param['company_name']]]);//WHERE (`id`='100000973') OR (`company_name` LIKE '%100000973%')
连接数据新增
$s = file_get_contents(__DIR__ . '/words.log');$arr = json_decode($s, true);$db = new yii\db\Connection(['dsn' => 'mysql:host=localhost;dbname=test','username' => 'root','password' => '','charset' => 'utf8',]);foreach($arr as $k => $item){$db->createCommand()->insert('forbidden_words', ['words' => $item])->execute();}
