PHP头条
热点:

thinkphp like 查询


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

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

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

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

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

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

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

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

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

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

您可能感兴趣的文章

  • ThinkPHP中的查询技巧总结
  • thinkphp 的 Action 控制器中的系统常量总结
  • thinkphp 如何去除url中的index.php
  • thinkphp模板中判断volist循环的最后一条记录
  • thinkphp打印最后一条sql语句
  • Thinkphp 模板中常用的系统变量总结
  • 使用ThinkPHP必须掌握的调试方法
  • Thinkphp 内部函数 ADSLCFUI 快捷方法全解析

www.phpzy.comtrue/php/218.htmlTechArticlethinkphp like 查询 在做项目的过程中,需要用到like关键字来组合查询条件,下面作者将在thinkphp中使用到的 like 查询做一下分享。 这里主要通过举例来说明用法: $userForm=M('user'); $where[...

相关文章

相关频道:

PHP之友评论

今天推荐