tp5时间搜索
发布日期:2021-05-07 01:08:42 浏览次数:23 分类:精选文章

本文共 1677 字,大约阅读时间需要 5 分钟。

前端:

JS:

$(".robHouse").click(function(){        var f2 = $(this).attr('data-id');        // console.log(f2)        $.ajax({            type:"post",            url:"doRob",            data:{                'id':f2            },            dataType:'json',            success:function(data){                alert(data.msg);                window.location.href = "{:url('/index/Integralroom/index')}";            },            error:function(err){                alert(err.msg);                window.location.href = "{:url('/index/Integralroom/index')}";            }        });    });

后端PHP代码:

///时间搜索            if (!empty($_POST['start_time'])&&!empty($_POST['end_time'])){                $start_time=strtotime(trim($_POST['start_time']));                $end_time=strtotime(trim($_POST['end_time']));                $map['start_time']=array('egt',$start_time);                $map['end_time']=array('elt',$end_time);                $s_time=date('Y-m-d',$start_time);                $e_time=date('Y-m-d',$end_time);            }else{                if (!empty($_POST['start_time'])){                    $start_time=strtotime(trim($_POST['start_time']));                    $map['start_time']=array('egt',$start_time);                    $s_time=date('Y-m-d',$start_time);                }                if (!empty($_POST['end_time'])){                    $end_time=strtotime(trim($_POST['end_time']));                    $map['end_time']=array('elt',$end_time);                    $e_time=date('Y-m-d',$end_time);                }            }

 记录一下 以后方便复用

 

 

 

 

上一篇:ThinkCMF报错未定义变量vo
下一篇:jeDate带时分秒的日期控件使用

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2025年04月17日 02时35分17秒