ThinkPHP3.2.3 日期区间查询
2016-07-02 03:14
567 查看
$map = array();
if ($username) {
$map['username'] = array('like', '%'.$username.'%');
}
if ($date_from && $date_to) {
$map['create'] = array(array('egt', strtotime($date_from)), array('elt', strtotime($date_to)));
} else if ($date_from) {
$map['create'] = array('egt', strtotime($date_from));
} else if ($date_to) {
$map['create'] = array('elt', strtotime($date_to));
}
if ($username) {
$map['username'] = array('like', '%'.$username.'%');
}
if ($date_from && $date_to) {
$map['create'] = array(array('egt', strtotime($date_from)), array('elt', strtotime($date_to)));
} else if ($date_from) {
$map['create'] = array('egt', strtotime($date_from));
} else if ($date_to) {
$map['create'] = array('elt', strtotime($date_to));
}
相关文章推荐
- PHP编写文件多服务器同步程序
- Windows Server 2008 R2和2012中PHP连接MySQL过慢的解决方法
- php global用法及作用
- php+ajax跨域单点登录怎么实现
- 初识PHP变量
- 初识PHP
- PHPSmarty
- php常用API接口收集
- Sublime Text [Decode error - output not utf-8]
- PHPDBG
- RabbitMQ+PHP 消息队列环境配置
- thinkphp3.2.3无法加载新建控制器:User
- PHP超大文件下载,断点续传下载
- 关于FileOutputStream
- php 数组排序以及按照某个字段排序
- 【Matplotlib】 移动spines
- TP3.2.3 Join 查询
- PHP编译安装时常见错误解决办法
- php.ini-development和php.ini-production的区别
- PHP网页缓存技术