为什么日志中显示会访问两次页面[已解决]

浏览:459 发布日期:2019/01/21 分类:ThinkPHP5专区 关键字: 日志 跳转 链接 5.1 两次
操作是访问demo_1 然后点链接,到达demo_2
期望 日志中 会有一条记录“测试”实际上有两条。
代码如下。<?php
namespace app\index\controller;

use think\Controller;
use think\facade\Request;
use think\facade\Log;

class TestController extends Controller {
    public function demo_1(){
        if(!Request::instance()->isGet()) die;
        echo "<a href='".url('demo_2')."'>测试2</a>";
    }

    public function demo_2(){
        if(!Request::instance()->isGet()) die;
        Log::record('测试');
    }
}
日志如下:---------------------------------------------------------------
[ 2019-01-21T16:27:33+08:00 ] 127.0.0.1 GET gz.com/index/test/demo_2.html
[运行时间:0.084670s] [吞吐率:11.81req/s] [内存消耗:1,545.48kb] [文件加载:104]
[ info ] [ LANG ] H:\wwwroot\TP51\lang\zh-cn.php
[ info ] [ ROUTE ] array (
)
[ info ] [ HEADER ] array (
  'cookie' => 'pgv_pvi=4239355904; PHPSESSID=qecmr5dh62e96hirdt0gsvrorv',
  'accept-language' => 'zh-CN,zh;q=0.9,en;q=0.8',
  'accept-encoding' => 'gzip, deflate',
  'referer' => 'http://gz.com/index/test/demo_1',
  'accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
  'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36',
  'upgrade-insecure-requests' => '1',
  'connection' => 'keep-alive',
  'host' => 'gz.com',
  'content-length' => '',
  'content-type' => '',
)
[ info ] [ PARAM ] array (
)
[ info ] 测试
---------------------------------------------------------------
[ 2019-01-21T16:27:34+08:00 ] 127.0.0.1 GET gz.com/index/test/demo_2.html
[运行时间:0.184468s] [吞吐率:5.42req/s] [内存消耗:1,545.21kb] [文件加载:104]
[ info ] [ LANG ] H:\wwwroot\TP51\lang\zh-cn.php
[ info ] [ ROUTE ] array (
)
[ info ] [ HEADER ] array (
  'cookie' => 'pgv_pvi=4239355904; PHPSESSID=qecmr5dh62e96hirdt0gsvrorv',
  'accept-language' => 'zh-CN,zh;q=0.9,en;q=0.8',
  'accept-encoding' => 'gzip, deflate',
  'referer' => 'http://gz.com/index/test/demo_2.html',
  'accept' => '*/*',
  'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36',
  'connection' => 'keep-alive',
  'host' => 'gz.com',
  'content-length' => '',
  'content-type' => '',
)
[ info ] [ PARAM ] array (
)
[ info ] 测试
请高手分析可能的原因,谢谢。
最佳答案
评论( 相关
后面还有条评论,点击查看>>