TP3 根据时间区间搜索的方法
/** * 时间段查询条件获取 * @param string $star 获取开始时间的字段名 * @param string $end 获取结束时间的字段名 * @param string $zd 数据库where条件的字段名 */ function where_time($start='start_time',$end='end_time',$zd='create_time'){ $start_time=I('get.'.$start,'','filter_str'); $end_time=I('get.'.$end,'','filter_str'); $map = array(); if(!empty($start_time)){ $start_time=strtotime($start_time); $map[$zd] = array('gt',$start_time); } if(!empty($end_time)){ $end_time=strtotime($end_time); if(empty($map[$zd])){ $map[$zd] = array('lt',$end_time); }else{ $map[$zd]=array($map[$zd],array('lt',$end_time)); } } return $map; }
【推荐】2025 HarmonyOS 鸿蒙创新赛正式启动,百万大奖等你挑战
【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】开源 Linux 服务器运维管理面板 1Panel V2 版本正式发布
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 Redis 客户端超时到 .NET 线程池挑战
· C23和C++26的#embed嵌入资源指南
· 「EF Core」框架是如何识别实体类的属性和主键的
· 独立开发,这条路可行吗?
· 我在厂里搞 wine 的日子
· 他没买 iPad,而是花了半年时间,为所有“穷学生”写了个笔记神器
· Visual Studio 现已支持新的、更简洁的解决方案文件(slnx)格式
· 只需一行命令,Win11秒变Linux开发主机!
· 上周热点回顾(7.7-7.13)
· 也是出息了,业务代码里面也用上算法了。