thinkphp like 查询_PHP教程

WBOY
Libérer: 2016-07-13 10:31:15
original
1156 Les gens l'ont consulté

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

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

$userForm=M('user');
Copier après la connexion
$where['name']=array('like','phpernote%');
$userForm->where($where)->select();
Copier après la connexion

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

$where['name']=array('like',array('%phpernote%','%.com'),'OR');
Copier après la connexion

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

$where['name']=array(array('like','%a%'),array('like','%b%'),array('like','%c%'),'phpernote','or');
Copier après la connexion

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

$where['_string']='(name like "%phpernote%")  OR (title like "%phpernote")';
Copier après la connexion

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

您可能感兴趣的文章

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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/764119.htmlTechArticle在做项目的过程中,需要用到like关键字来组合查询条件,下面作者将在thinkphp中使用到的 like 查询做一下分享。 这里主要通过举例来说明用...
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!