在大多数情况下推荐使用索引数组或者对象来作为查询条件,因为这样会更加安全,详细参见:《ThinkPHP 类型检测》。
使用数组方式的 where 条件例子:
$Dao = M("User");
// 构建查询数组
$condition['uid'] = array('elt',10);
$condition['email'] = "Jack@163.com";
$List = $Dao->where($condition)->find();
这个例子跟上面使用字符串方式的例子执行效果是一样的。