以下代码是调用24小时内的数据,请问怎么改成调用一个月或一年的数据
- PHP code
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> private function getList($where='',$no_query = false) { global $_FANWE; if(!$no_query) { if(defined('IS_CACHE_TPL')) $fields = ''; else $fields = ',g.post_count'; $page_args = array( 'city_py' => CURRENT_CITY_PY, 'site' => intval($_FANWE['request']['site']), 'cat' => intval($_FANWE['request']['cat']), 'sort' => trim($_FANWE['request']['sort']), 'date' => trim($_FANWE['request']['date']), 'keyword' => trim($_FANWE['request']['keyword']), 'prices' => trim($_FANWE['request']['prices']), ); $site_id = 0; if($page_args['site'] > 0) { $site_id = $page_args['site']; $site_where = ' AND gk.site_id = '.$page_args['site']; } else unset($page_args['site']); $dates = S('Goods')->getExpiredGoodsDate(); $min_time = getTodayTime(); $max_time = TIME_UTC; $date = toDate($min_time,'Y-m-d'); if(!empty($page_args['date'])) { $time = str2Time($page_args['date']); if($time = $dates['min_time']) { $date = toDate($time,'Y-m-d'); $min_time = str2Time(toDate($time,'Y-m-d')); $max_time = $min_time + 863990000; if($max_time > TIME_UTC) $max_time = TIME_UTC; } } else { $page_args['date'] = $date; } $dates['min_time'] = toDate($dates['min_time'],'r'); $dates['max_time'] = toDate($dates['max_time'],'r'); $where.=" AND gk.end_time >= '$min_time' AND gk.end_time 0) $insert_sort = 'gk.ec_sort ASC'; if(in_array($page_args['cat'],$_FANWE['cache']['goods']['root_cates'])) $insert_sort = 'gk.dc_sort ASC'; $city_name = $_FANWE['current_city']['name']; if(CURRENT_CITY_PY == CHINA_CITY_PY) { //全国不包含所有城市商品时 if($_FANWE['setting']['all_city'] == 0) $where.= " AND gk.city = '$city_name'"; else { $insert_sort = 'gk.r_sort ASC'; if($page_args['cat'] > 0) $insert_sort = 'gk.e_sort ASC'; if(in_array($page_args['cat'],$_FANWE['cache']['goods']['root_cates'])) $insert_sort = 'gk.d_sort ASC'; } } elseif(CURRENT_CITY_PY != '') { //城市显示全国商品时 if($_FANWE['setting']['index_all'] == 1) { $fields .= ",(gk.city = '$city_name') as is_now_city"; $insert_sort = 'is_now_city DESC,'.$insert_sort; $quanguo_name = $_FANWE['cache']['city']['all'][CHINA_CITY_PY]['name']; $where.= " AND gk.city IN ('$city_name','$quanguo_name')"; } else { $where.= " AND gk.city = '$city_name'"; } } //价格条件 $prices = ''; if(!empty($page_args['prices'])) { $prices = &$page_args['prices']; $price_arr = explode(',',$prices); $price_min = intval($price_arr[0]); $price_max = intval($price_arr[1]); if($price_min > 0) $where.=" AND (g.shop_price >= $price_min)"; if($price_max > 0) $where.=" AND (g.shop_price getExpiredGoodsCats($site_where.$where); $cate_id = 0; if($page_args['cat'] > 0) { $cate_id = &$page_args['cat']; $cateobj = $_FANWE['cache']['goods']['cats'][$cate_id]; $cate_ids = array(); if(isset($cateobj['childs'])) $cate_ids = $cateobj['childs']; $cate_ids[] = $cate_id; if(count($cate_ids) > 1) $where.=' AND gk.cate_id IN ('.implode(',', $cate_ids).')'; else $where.=" AND gk.cate_id = '$cate_id'"; } else unset($page_args['cat']); $goods_sites = S('Goods')->getExpiredGoodsSites($where); $where = $site_where.$where; $order = ''; $sort = &$page_args['sort']; $sort_array = array('spa'=>'g.shop_price ASC','spd'=>'g.shop_price DESC','eta'=>'g.end_time ASC','etd'=>'g.end_time DESC','cca'=>'g.click_count ASC','ccd'=>'g.click_count DESC','sa'=>'g.score ASC','sd'=>'g.score DESC','ba'=>'g.bought ASC','bd'=>'g.bought DESC','da'=>'discount ASC','dd'=>'discount DESC'); if(array_key_exists($sort,$sort_array)) $order = $sort_array[$sort]; else { unset($page_args['sort']); $sort = ''; } if(empty($order)) $order .= 'g.is_best DESC,'.$insert_sort.',g.sort ASC,g.id ASC'; else $order .= ','.$insert_sort.',g.sort ASC,g.id DESC'; $goods_count = S('Goods')->getExpiredGoodsCount($where); $pager = buildPage('goods/'.ACTION_NAME,$page_args,$goods_count,$_FANWE['page'],15); $goods_result = S('Goods')->getExpiredGoodsList($where,$order,$fields,$pager['limit']); $goods_result['ids'] = implode(',',$goods_result['ids']); } include template('page/goods_index'); } <div class="clear"> </div>

aphpdepentioncontiveContainerIsatoolThatManagesClassDeptions,增強codemodocultion,可驗證性和Maintainability.itactsasaceCentralHubForeatingingIndections,因此reducingTightCightTightCoupOulplingIndeSingantInting。

選擇DependencyInjection(DI)用於大型應用,ServiceLocator適合小型項目或原型。 1)DI通過構造函數注入依賴,提高代碼的測試性和模塊化。 2)ServiceLocator通過中心註冊獲取服務,方便但可能導致代碼耦合度增加。

phpapplicationscanbeoptimizedForsPeedAndeffificeby:1)啟用cacheInphp.ini,2)使用preparedStatatementSwithPdoforDatabasequesies,3)3)替換loopswitharray_filtaray_filteraray_maparray_mapfordataprocrocessing,4)conformentnginxasaseproxy,5)

phpemailvalidation invoLvesthreesteps:1)格式化進行regulareXpressecthemailFormat; 2)dnsvalidationtoshethedomainhasavalidmxrecord; 3)

tomakephpapplicationsfaster,關注台詞:1)useopcodeCachingLikeLikeLikeLikeLikePachetoStorePreciledScompiledScriptbyTecode.2)MinimimiedAtabaseSqueriSegrieSqueriSegeriSybysequeryCachingandeffeftExting.3)Leveragephp7 leveragephp7 leveragephp7 leveragephpphp7功能forbettercodeefficy.4)

到ImprovephPapplicationspeed,關注台詞:1)啟用opcodeCachingwithapCutoredUcescriptexecutiontime.2)實現databasequerycachingingusingpdotominiminimizedatabasehits.3)usehttp/2tomultiplexrequlexrequestsandreduceconnection.4 limitesclection.4.4

依赖注入(DI)通过显式传递依赖关系,显著提升了PHP代码的可测试性。1)DI解耦类与具体实现,使测试和维护更灵活。2)三种类型中,构造函数注入明确表达依赖,保持状态一致。3)使用DI容器管理复杂依赖,提升代码质量和开发效率。

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

SublimeText3漢化版
中文版,非常好用

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

Dreamweaver Mac版
視覺化網頁開發工具