In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about how php can add one points every day. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Php realizes the method of adding one points per day: 1. Add a field logintime;2 to the data table and compare the 00:00 zero seconds of the day with the last login time; 3. Through "if ($lastLogintime)"
< $today) {...}"实现积分增加即可。 本文操作环境:Windows7系统,PHP7.4版,Dell G3电脑。 php实现一天多次登录,只积分一次功能: 在网上找了很多的案例,感觉都差不多,有的还比较的繁琐,就自己尝试了一下,如何实现这个功能 实现这个功能我在数据表里面增加了一个字段logintime,表示最后一次的登录时间,然后使用一天中的零时零分零秒和上一次的登录时间进行比较,如果上一次的登录时间大于了这个时间点表示已经登陆过,如果上一次的登录时间小于了这个时间点,则表示第一次登录,增加积分 上代码: // 判断是否是一天中第一次登录// 上一次登陆的时间$lastLogintime = $userinfo['logintime'];// 一天中的零时零分零秒$today = strtotime(date('Y-m-d'));if($lastLogintime < $today) { // 一天中第一次登录增加积分(关联更新) // 注意:使用关联更新数据的时候需要传递两次id $data['id'] = $userinfo['id']; $data['userinfo'] = array( 'points' =>$userinfo ['points'] + C (' LOGIN'),); $user- > relation (true)-> where (array ('id'= > $userinfo [' id']))-> save ($data);}
It is important to note that you also need to modify the login time:
/ / Update login time and login ip$updateData = array ('id'= > $userinfo [' id'], 'userinfo' = > array (' logintime' = > time (), 'loginip' = > getIP (),)); $user- > relation (true)-> where (array (' id'= > $userinfo ['id']))-> save ($updateData)
Thank you for reading! On "php how to achieve daily points plus one" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!
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.