limitTime) { $content = "频繁提交,请稍候再试"; $type = "html"; header("Content-type: text/html; charset=utf-8"); return Response::create($content, $type, 0); } } $cookie = cookie($k); if (empty($cookie)) { //保存到晚上12点 $saveTime = strtotime(date("Y-m-d", time()) . " 23:59:59"); setcookie($k, (string)time(), $saveTime, "/"); $cookie = "first"; } else { $cookie = "continue"; } if (key_exists('fp', $_GET)) { $_GET['fp']; } $mobileText = "计算机端浏览器"; if (is_mobile()) { $mobileText = "移动端浏览器"; } //在搜索引擎搜索个关键词,进入网站 $word = search_word_from(); if (!empty($word['keyword'])) { echo '关键字:' . $word['keyword'] . ' 来自:' . $word['from']; } if (key_exists('fp', $_GET)) { $from_page = $_GET['fp']; } else { $from_page = getFromPage(); } $page_title = getPageTitle($from_page); //网页标题 if (empty($page_title)) { $page_title = "访问进入了"; } $startTime = date("Y-m-d") . " 00:00:00"; $endTime = date("Y-m-d") . " 23:59:59"; $browser = getBrowser(); $as = AccessStat::where([['ip', '=', $ip], ['from_page', '=', $from_page], ['browser', '=', $browser]])->whereBetweenTime("create_time", $startTime, $endTime)->find(); if ($as) { $type = "html"; $content = "'存在" . $cookie . "'"; header("Content-type: text/html; charset=utf-8"); return Response::create($content, $type, 200); } $accessStat = ["cookie" => $cookie, "ip" => $ip, "browser" => $browser, "from_page" => $from_page, "source_site" => $word['from'], "browser_type" => $mobileText, 'page_title' => $page_title]; try { AccessStat::create($accessStat); saveToCache($k, time()); //记录一下时间 } catch (\Exception $e) { $type = "html"; $content = "'" . $e->getMessage() . "'"; return Response::create($content, $type, 200); } $type = "html"; $content = "'成功" . $cookie . "'"; header("Content-type: text/html; charset=utf-8"); return Response::create($content, $type, 200); } public function check() { return "check"; } }