In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how php query this year's data, I hope you will learn something after reading this article, let's discuss it together!
Php query this year's data: 1, obtain the current year's time through date; 2, run the query statement "$result = $db- > where ($where)-> select ();".
This article operating environment: Windows7 system, thinkphp v5.1, Dell G3 computer.
Thinkphp inquires the data of that day, this week, this month and this year.
Codes such as:
/ / time of the day $where ['time'] = array (array (' egt',strtotime (date ('Ymurmshai donglue time (), array (' lt',strtotime ('date (' Ymurmlite donglagame time ().'+ 1 day')); / / time of the week $where ['time'] = array (array (' egt',strtotime (date ('Ymurmcopyright dazzle time ().'-'.date (' wicked moment time ()). Day'), array ('lt',strtotime (date (' Ymurmmurdjue time ().'+ 1 week-'.date (' wishful minute time ()). Day');); / / time of the month $where ['time'] = array (' egt',strtotime ('date (' Ymurmurmlaga time (), array ('lt',strtotime (date (' Ymurmlyne time ()).'+ 1 month') / / time of the year $where ['time'] = array (array (' egt',strtotime (date ('Yoshikwashi (), array (' lt',strtotime (date ('YLTHEROTY time ()).' + 1 year')
Above are the query conditions, which can be directly applied to the query statement.
$result = $db- > where ($where)-> select ()
Correct the query time of the above year.
$where ['time'] = array (array (' egt',strtotime (date ('Ymur01-01) recording time ()), array (' lt',strtotime (date ('Ymur01-01)). + 1 year')
Repair version
/ / yesterday's time $yesterday ['addtime'] = array (' egt',strtotime (date ('Ymurmmurdjinyashi ()).'-1 day')), array ('lt',strtotime (date ()) / / time of the day $day ['addtime'] = array (' egt',strtotime ('egt',strtotime (date (' Ymurmmurdjinyashi (), array ('lt',strtotime (date ()). + 1 day') / / time of the month $month ['addtime'] = array (array (' egt',strtotime (date ('Ykoshou pageTime (), array (' lt',strtotime (date ('Ylyphou month' time ()).' + 1 month')); / time of the week $week ['addtime'] = array (array (' egt',strtotime (date ('YlypheTime time ().'-.date ('wicked PowerTime ()). Day'), array ('lt',strtotime (date (' Ymurmmurdongju time ().'+ 1 week-'.date (' wicked magic time ()). Day')
After reading this article, I believe you have a certain understanding of "how to query this year's data in php". If you want to know more about it, please follow the industry information channel. Thank you for your reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.