<?php //获取系统年份 /** * * @return string[] */ function getSystemYearArr(){ $year_arr = array('2010'=>'2010','2011'=>'2011','2012'=>'2012','2013'=>'2013','2014'=>'2014','2015'=>'2015','2016'=>'2016','2017'=>'2017','2018'=>'2018','2019'=>'2019','2020'=>'2020'); return $year_arr; } /** * 获得系统月份数组 * * @return array */ function getSystemMonthArr(){ $month_arr = array('1'=>'01','2'=>'02','3'=>'03','4'=>'04','5'=>'05','6'=>'06','7'=>'07','8'=>'08','9'=>'09','10'=>'10','11'=>'11','12'=>'12'); return $month_arr; } /** * 处理搜索时间 */ public function dealwithSearchTime($search_arr){ //初始化时间 //天 if(!$search_arr['search_time']){ $search_arr['search_time'] = date('Y-m-d', time()- 86400); } $search_arr['day']['search_time'] = strtotime($search_arr['search_time']);//搜索的时间 //周 if(!$search_arr['searchweek_year']){ $search_arr['searchweek_year'] = date('Y', time()); } if(!$search_arr['searchweek_month']){ $search_arr['searchweek_month'] = date('m', time()); } if(!$search_arr['searchweek_week']){ $search_arr['searchweek_week'] = implode('|', getWeek_SdateAndEdate(time())); } $weekcurrent_year = $search_arr['searchweek_year']; $weekcurrent_month = $search_arr['searchweek_month']; $weekcurrent_week = $search_arr['searchweek_week']; $search_arr['week']['current_year'] = $weekcurrent_year; $search_arr['week']['current_month'] = $weekcurrent_month; $search_arr['week']['current_week'] = $weekcurrent_week; //月 if(!$search_arr['searchmonth_year']){ $search_arr['searchmonth_year'] = date('Y', time()); } if(!$search_arr['searchmonth_month']){ $search_arr['searchmonth_month'] = date('m', time()); } $monthcurrent_year = $search_arr['searchmonth_year']; $monthcurrent_month = $search_arr['searchmonth_month']; $search_arr['month']['current_year'] = $monthcurrent_year; $search_arr['month']['current_month'] = $monthcurrent_month; return $search_arr; }
php实现按天数、星期、月份查询的搜索框(4)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://www.heiqu.com/7c546f2098abba7bc33d1057e97adae5.html