模板文件:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>资讯管理-{$site.SITE_INFO.name}</title>
<php>    
            $addCss="";
            $addJs="";
            $currentNav ='资讯管理 > 资讯列表';
        </php>
        <include file="Common:intoHead" />
        <script type="text/javascript" src="__PUBLIC__/My97DatePicker/WdatePicker.js"></script>
    </head>
    <body>
    <script> 
function import_check(){ 
    var f_content = form1.file.value; 
    var fileext=f_content.substring(f_content.lastIndexOf("."),f_content.length) 
        fileext=fileext.toLowerCase() 
     if (fileext!='.xlsx') 
        { 
         alert("对不起,导入数据格式必须是xlsx格式文件哦,请您调整格式后重新上传,谢谢 !");            
         return false; 
        } 
else{ document.getElementById("form1").submit();}


</script> 
        <div class="wrap">
            <include file="Common:head" />
            <div class="mainBody">
                <include file="Common:left" />
                <div id="Right">
                    <div class="Item hr">
                        <div class="current">资讯列表</div>
                        
                    </div>
                    <div align="right" id="excels">
                        <form id="form1" name="form1" enctype="multipart/form-data" method="post" action="__APP__/Lawerinfo/sqlinsert"> 
                        <table><tr> <td width="400px;" height="50"> 选择你要导入的数据表:</td> 
                         <td width="82%"><label> 
                         <input name="file" type="file" id="file" size="50" /> 
                                    </label> 
                            <label> 
                            <input name="button" type="button" class="nnt_submit" id="button" value="导入数据"  onclick="import_check();"/><font color="#FF0000">*</font><font color="#009900"><?php echo $_GET[tishi]; ?></font>
                            </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s_s" style="color:#0000FF; cursor:pointer" onclick="$(this).hide(); $('.search').show();$('#excels').hide();">[搜索条件]</span>
 </td><td></td></tr></table>
                        </form></div>
                    <div style="padding-left:30px; padding-right:30px;">
<form name="frmSearch" method="get" action="{:U('index')}">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab search" style="display:none">
                        <th colspan="2" style="text-align:left; color:#FF0000">此搜索是模糊匹配,输入任意一个条件即可查找!</th>
<tr>
<td style="width:120px; text-align:right">姓名:</td>
<td><input name="name" type="text" class="input" size="40" /> </td>
</tr>
<tr>
<td style="text-align:right">手机号:</td>
<td><input name="mobile" type="text" class="input" size="40" maxlength="11" /> </td>
</tr>
<tr>
<td style="text-align:right">邮箱:</td>
<td><input name="email" type="text" class="input" size="40" /> </td>
</tr>
<tr>
<td style="text-align:right">用户角色:</td>
<td>
<select name="sex" class="input" style="height:30px">
                                        <option value="">无</option>
<option value="男">男</option>
<option value="女">女</option>
</select>
</td>
</tr>
<tr>
<td style="text-align:right">注册时间:</td>
<td>
<input name="st" type="text" class="input" size="26" onFocus="WdatePicker({isShowClear:false,readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
&nbsp;&nbsp;—&nbsp;&nbsp;
<input name="et" type="text" class="input" size="26" onFocus="WdatePicker({isShowClear:false,readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
</td>
</tr>
<tr>
<td style="text-align:right">&nbsp;</td>
<td>
<span style="color:#0000FF; cursor:pointer" onclick="document.frmSearch.submit();">[搜 索]</span>
&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:#0000FF; cursor:pointer" onclick="$('.search').hide(); $('.s_s').show();$('#excels').show();">[关 闭]</span>
</td>
</tr>
</table>
</form>
</div>
                        <form action="__APP__/Lawerinfo/deletes" method="post">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab">
                        <thead>
                            <tr>
                                <td><strong><span id="alls" style="color:#006600; cursor:pointer">√全选</span></strong></td>
                                <td>执业证号</td>
                                <td>律师姓名</td>
                                <td>性别</td>
                                <td>律师事务所名称</td>
                                <td>律所地址</td>
                                <td>首次执业日期</td>
                                <td>律所电话</td>
                                <td>律所学历</td>
                                <td width="150">操作</td>
                            </tr>
                        </thead>
                        
                        <volist name="list" id="vo">
                            <tr align="center" id="{$vo.id}" class="checks">
                                <td><input type="checkbox" name="id[]" value="{$vo.id}"/></td>
                                <td>{$vo.certificate_num}</td>
                                <td>{$vo.true_name}</td>
                                <td>{$vo.sex}</td>
                                <td>{$vo.law_firm_name}</td>
                                <td>{$vo.law_firm_address}</td>
                                <td>{$vo.first_date}</td>
                                <td>{$vo.lawer_phone}</td>
                                <td>{$vo.lawer_xueli}</td>
                                <td>[ <a href="__URL__/edit/id/{$vo.id}/tb/1">编辑 </a> ] [ <a link="{:U('Lawerinfo/del/',array('id'=>$vo['id']))}" href="javascript:void(0)" name="{$vo.title}" class="del">删除 </a> ]</td>
                            </tr>
                        </volist>
                        <tr style="text-align:center"><td><input type="submit"  onclick="return confirm('确定要删除选中项吗?')" value="删除被选项" id="bt" /></td><td colspan="8">{$page}</td></tr>
                    </table>
                    </form>
                </div>
            </div>
        </div>
        <div class="clear"></div>
        <include file="Common:foot" />
        <script src="__PUBLIC__/Js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript">
            $(function(){
                $(".del").click(function(){
                    var delLink=$(this).attr("link");
                    popup.confirm('你真的打算删除【<b>'+$(this).attr("name")+'</b>】吗?','温馨提示',function(action){
                        if(action == 'ok'){
                            top.window.location.href=delLink;
                        }
                    });
                    return false;
                }); 
            });
$(function(){
   $("#alls").toggle(function(){
       $("input:checkbox").attr("checked",true);
$(this).html("X取消全选");
$(this).css("color",'red');
    },function(){
   $("input:checkbox").attr("checked",false);
$(this).html("√全选");
$(this).css("color",'#006600');
})
});
$(function(){
  
})
        </script>
    </body>
</html>

控制器:

public function index() {
   //作为搜索条件查找某律师的信息
   $where = '1=1';
if(!empty($_GET['name'])) $where .= ' and true_name regexp \'' . trim($_GET['name']) . '\'';
if(!empty($_GET['mobile'])) $where .= ' and law_mobile regexp \'' . trim($_GET['mobile']) . '\'';
if(!empty($_GET['email'])) $where .= ' and email regexp \'' . trim($_GET['email']) . '\'';
if(!empty($_GET['sex'])) $where .= ' and sex regexp \'' . trim($_GET['sex']) . '\'';
if(!empty($_GET['st'])) $where .= ' and first_date >= \'' . substr(str_replace('+', ' ', $_GET['st']),0,4) . '\'';
if(!empty($_GET['et'])) $where .= ' and first_date <= \'' . substr(str_replace('+', ' ', $_GET['et']),0,4) . '\'';
        $M = M("Constant");  
        $count = $M->where($where)->count();
        import("ORG.Util.Page"); // 导入分页类
   $d = new Page($count,15);  //分页
   $list=$M->limit($d->firstRow.','.$d->listRows)->select();
   $dd=$d->show();
        $this->assign('list', D('Lawerinfo')->listMember($d->firstRow, $d->listRows, $where));
     $this->assign('page',$dd); 
        $this->display();
   }

模型层:

public function listMember($firstRow = 0, $listRows = 20, $where) {
        $M = M('Constant');

$list = $M->where($where)->limit("$firstRow , $listRows")->select();

return $list;
    }

thinkphp实现模糊匹配(学习贵哥代码)的更多相关文章

  1. FuzzyAutocomplete代码模糊匹配智能提示

    下载地址:https://github.com/FuzzyAutocomplete/FuzzyAutocompletePlugin Xcode 7.3.1 中已经对代码模糊匹配智能提示优化,已经不需要 ...

  2. mysql学习2:模糊匹配查询like,regexp,in

    mysql模糊匹配查询like,regexp,in   摘要 内容比较简单,无摘要.   关键词 模糊查询  like  regexp  in  contact   正文 下图是示例用到的数据表信息 ...

  3. DevExpress控件cxGrid实现多列模糊匹配输入的完美解决方案

    本方案不需要修改控件源码,是完美解决cxgrid或TcxDBExtLookupComboBox支持多列模糊匹配快速输入的最佳方案!! 转自https://blog.csdn.net/qq5643020 ...

  4. EasyUi模糊匹配搜索框combobox

    现在项目当中很多已经应用了Jquery-easyUi这个界面框架了,所以,学习一点easyUI的常用工具就显得很重要了,现在介绍的就是我在项目中用到的easyUi的模糊匹配组合框combobox. c ...

  5. 学习坤哥的replaceTpl方法

    学习坤哥的方法之后自己写的replaceTpl function replaceTpl(tpl, data){///////////////没有传入可让用户自己定义的方式进行替换,不够灵活       ...

  6. 记一个同时支持模糊匹配和静态推导的Atom语法补全插件的开发过程: 序

    简介 过去的一周,都睡的很晚,终于做出了Atom上的APICloud语法提示与补全插件:apicloud_autocomplete.个中滋味,感觉还是有必要记录下来的.代码基于 GPL-3.0 开源, ...

  7. 茗洋Easy UI 1.3.2 部分问题解决系列专题[Combo模糊匹配中文问题 修复]

    本次给大家带来的EasyUI的我研究拓展的新特性 我使用的是  EasyUI 1.3.2版本的,项目是ASP.NET MVC3,但是本篇讲解用不上ASP.NET MVC,仅仅修改官方Demo你就知道怎 ...

  8. grep是模糊匹配

    1. 我:我用的ps -nat|grep -i "80"|wc -l命令 我:解释详细点,,龙哥,对于我这种菜鸟:也是模糊匹配 :你用 grep "80" 会匹 ...

  9. ExtJs combobox支持模糊匹配

    其实很简单,我们只需要在创建下拉框时,给下拉框添加一个监听事件,代码如下:   //以下监听事件用于对下拉项进行模糊匹配                     ,listeners:{       ...

随机推荐

  1. Java运算符(一)equals方法与“==”

    超类Object的equals只是比较两者之间的引用对象是否相同,这一点跟操作符“==”是一样的. 在基本数据类型中,“==”用于比较两者之间的值(内容)是否相等. 在引用类型中,“==”用于比较两者 ...

  2. OA学习笔记-009-岗位管理的CRUD

    一.分析 Action->Service->Dao CRUD有功能已经抽取到BaseDaoImpl中实现,所以RoleDaoImpl没有CRUD的代码,直接从BaseDaoImpl中继承 ...

  3. 【Xamarin挖墙脚系列:mac 终端 常用命令+Mac OS X的快捷键+beamoff 】

    原文:[Xamarin挖墙脚系列:mac 终端 常用命令+Mac OS X的快捷键+beamoff ] 基本命令 1.列出文件 ls 参数 目录名        例: 看看驱动目录下有什么:ls /S ...

  4. 全球AI界最值得关注的十位科学家

    全球AI界最值得关注的十位科学家   我们可以看到AI已经从象牙塔里的高冷研究,逐步转换为科技公司.互联网公司的最核心竞争力.AI代表了这时代人类的前沿智慧,也正达到一种科学的极致. 这两天在美国加利 ...

  5. bzoj2209 2329

    括号序列的经典做法把(看成1,)看成-1匹配的括号序列即任意前缀和都非负我们先解决静态的问题,给定一段括号序列求最少修改次数我们先找出最大后缀和a和最小前缀和b之间一定可以不相交显然a+|b|个括号是 ...

  6. BZOJ_1269_文本编辑器_[AHOI2006]_(Spaly)

    描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1269 和BZOJ_1507很像的题,多了一个反转操作,还是Splay简单区间操作的模板题. 1 ...

  7. BZOJ_3224_普通平衡树_(Treap)

    描述 http://www.lydsy.com/JudgeOnline/problem.php?id=3224 Treap模板题.支持如下几种操作: 1.插入; 2.删除; 3.rank(x); 4. ...

  8. 【Moment.js】

    Moment.js Moment.js中文网 var moment = require('moment') moment.locale('zh-cn') /* 九月 13日 2015, 4:45:25 ...

  9. VM Depot 助您使用本地开源软件架设开发 Web 站点

     发布于 2014-04-25 作者 云 浪生 使用 VM Depot 中的镜像在 Azure 上创建.开发.部署网站与应用不仅方便快捷而且省时省力!感谢开源社区的大力支持,我们的VM Depot ...

  10. ios扩展机制objc_setAssociatedObject,objc_getAssociatedObject

    这个可以解决变量传递问题, 就不用定义全局的了. 使用例子: 首先导入头文件:#import <objc/runtime.h> 设置静态常量:static char alertinfoke ...