为了账号安全,请及时绑定邮箱和手机立即绑定

请问ThinkPHP 中 where条件 or,and 同时使用~请大神出现~?

请问ThinkPHP 中 where条件 or,and 同时使用~请大神出现~?

守着星空守着你 2018-08-10 08:05:15
('a'=1or'b'=2)and('c'=3or('d'=4and'e'=5))请不要使用字符串_string,只用_logic和_complex。谢谢...
查看完整描述

1 回答

?
有只小跳蛙

TA贡献1824条经验 获得超8个赞

$where['_complex'] = [    [        'a' => 1,         'b' => 2,         '_logic' => 'or'    ],    [        'c' => 3,         '_complex' => [            'd' => 4,             'e' => 5        ],         '_logic' => 'or'    ]];

如不提供_logic属性,则thinkphp使用默认属性and进行条件连接。

也就是(结构补充完整):

12345678910111213141516$where['_complex'] = [    [        'a' => 1,         'b' => 2,         '_logic' => 'or'    ],    [        'c' => 3,         '_complex' => [            'd' => 4,             'e' => 5,            '_logic' => 'and'//这一行可缺损        ],         '_logic' => 'or'    ]];


查看完整回答
反对 回复 2018-08-10
  • 1 回答
  • 0 关注
  • 4700 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信