<?php $url_info = "Admin/".CONTROLLER_NAME.'/'.ACTION_NAME; $send_count = M('SendCount'); $url = $send_count ->field('id,spendcount,request,maxrequest,minrequest') ->where("url='%s'",$url_info) ->find(); if(!empty($url)){ $times = round(microtime(true)-BEGIN_TIME,3); $serd['spendcount'] =$url['spendcount'] + 1; $serd['request'] =$url['request'] + 1; $serd['create_time'] = time(); $serd['minrequest'] = $times; $serd['maxrequest'] = $url['maxrequest'] > $url['minrequest'] ? $url['maxrequest'] : $url['minrequest']; M('SendCount')->where('id='.$url['id'].'')->save($serd); }else{ $times = round(microtime(true)-BEGIN_TIME,3); $serd['spendcount'] = 1; $serd['url'] = $url_info; $serd['request'] = $times; $serd['minrequest'] = $times; $serd['create_time'] = time(); $serd['type'] = 2; M('SendCount')->add($serd); } 入口文件需设置: define('BEGIN_TIME',microtime(true));
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。