Home > php教程 > php手册 > thinkphp like 查询

thinkphp like 查询

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 09:36:33
Original
1725 people have browsed it

在做项目的过程中,需要用到like关键字来组合查询条件,下面作者将在thinkphp中使用到的 like 查询做一下分享。

这里主要通过举例来说明用法:

$userForm=M('user');
Copy after login
$where['name']=array('like','phpernote%');
$userForm->where($where)->select();
Copy after login

这里的like查询即为:name like 'phpernote%'

$where['name']=array('like',array('%phpernote%','%.com'),'OR');
Copy after login

这里的like查询即为:name like '%phpernote%' or name like '%.com'

$where['name']=array(array('like','%a%'),array('like','%b%'),array('like','%c%'),'phpernote','or');
Copy after login

这里的like查询即为:(`name` LIKE '%a%') OR (`name` LIKE '%b%') OR (`name` LIKE '%c%') OR (`name` = 'phpernote')

$where['_string']='(name like "%phpernote%")  OR (title like "%phpernote")';
Copy after login

这里的like查询即为:name like '%phpernote%' or title like '%phpernote'

您可能感兴趣的文章

  • ThinkPHP中的查询技巧总结
  • thinkphp 的 Action 控制器中的系统常量总结
  • thinkphp 如何去除url中的index.php
  • thinkphp模板中判断volist循环的最后一条记录
  • thinkphp打印最后一条sql语句
  • Thinkphp 模板中常用的系统变量总结
  • 使用ThinkPHP必须掌握的调试方法
  • Thinkphp 内部函数 ADSLCFUI 快捷方法全解析
Related labels:
Statement of this Website
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
Latest Issues
Why thinkphp has better performance than laravel?
From 1970-01-01 08:00:00
0
0
0
ThinkPHP Why use composer?
From 1970-01-01 08:00:00
0
0
0
thinkphp versions supported by php6
From 1970-01-01 08:00:00
0
0
0
thinkphp upload files
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template