Home  >  Article  >  Backend Development  >  Yii关于数据获取的有关问题

Yii关于数据获取的有关问题

WBOY
WBOYOriginal
2016-06-13 13:16:10734browse

Yii关于数据获取的问题
$res = Yii::app()->db->createCommand()
  ->select('uid,uname,ucreatetime,utelephone,umobile')
  ->from('yc_userinfo')
  ->where('uroleid=3 or uroleid=4')
  ->queryAll();
请问 where('uroleid=3 or uroleid=4') 这段 用AR时候 params 怎么指定啊?

------解决方案--------------------
params是与condition一一对应的你condition=>'uroleid=:uroleid',params=>array(':uroleid'=>3);这样就行了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn