ThinkPHP Where 条件中使用表达式
来源:互联网 发布:linux arp命令 编辑:程序博客网 时间:2024/05/01 19:22
Where 条件表达式格式为:
$map['字段名'] = array('表达式', '操作条件');
其中 $map 是一个普通的数组变量,可以根据自己需求而命名。上述格式中的表达式实际是运算符的意义:
补充说明
- 同 SQL 一样,ThinkPHP运算符不区分大小写,eq 与 EQ 一样。
- between、 in 条件支持字符串或者数组,即下面两种写法是等效的:
$map['id'] = array('not in','1,5,8');$map['id'] = array('not in',array('1','5','8'));
exp 表达式
上表中的 exp 不是一个运算符,而是一个综合表达式以支持更复杂的条件设置。exp 的操作条件不会被当成字符串,可以使用任何 SQL 支持的语法,包括使用函数和字段名称。
exp 不仅用于 where 条件,也可以用于数据更新,如:
$Dao = M("Article");// 构建 save 的数据数组,文章点击数+1$data['id'] = 10;$data['counter'] = array('exp','counter+1');// 根据条件保存修改的数据$User->save($data);
阅读全文
0 0
- ThinkPHP Where 条件中使用表达式
- ThinkPHP Where 条件中使用表达式
- ThinkPHP Where 条件中使用表达式
- ThinkPHP Where 条件中使用表达式
- ThinkPHP Where 条件中使用表达式
- ThinkPHP Where 条件中使用表达式
- ThinkPHP Where 条件中使用表达式
- ThinkPHP Where 条件中使用表达式---$map
- ThinkPHP Where 条件中使用表达式
- ThinkPHP Where 条件中使用表达式
- ThinkPHP Where 条件中使用表达式
- ThinkPHP Where 条件中常用表达式示例
- Thinkphp的where条件
- ThinkPHP中CURD where的使用注意事项
- ThinkPHP中where()方法的使用
- PL/SQL where 条件中使用case
- where 条件中 使用 instr 替代 in
- thinkphp中使用查询表达式
- Genymotion问题和解决方法
- 【C#】更新界面显示并解决this.Invoke无法访问已释放的对象
- LeetCode 402. Remove K Digits
- 【脚本语言系列】关于Python实现网络模式发布-订阅,你需要知道的事
- Effective Modern C++: Item 3 ->弄清decltype
- ThinkPHP Where 条件中使用表达式
- oracle 服务器端搭建(C#开发环境)
- 存储协议SCSI 初探
- [js]css处理浮动后父元素的高度
- wpa_supplicant, wpa_cli用法
- IntelliJ IDEA开发SpringMVC网站(上)
- 端口分类
- 关于EXT JS 的所有组件
- Maven常用命令