V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
JasonTsang
V2EX  ›  PHP

Yii2 为什么 debug-toolbar 调试工具栏不显示了?

  •  
  •   JasonTsang · 2019-03-29 14:43:57 +08:00 · 4266 次点击
    这是一个创建于 1847 天前的主题,其中的信息可能已经有所发展或是发生改变。

    avatar

    Yii2 为什么 debug-toolbar 调试工具栏不显示了?

    8 条回复    2019-04-04 01:03:58 +08:00
    JasonTsang
        1
    JasonTsang  
    OP
       2019-03-29 17:12:41 +08:00
    没有人吗
    Paual
        2
    Paual  
       2019-03-29 17:16:05 +08:00
    我看着你的代码不像是最新 Yii2 的代码,然后我也遇到过 debug 不出来的情况,我的是最新的版本,在 web/config.php 下面有一个配置的地方,默认允许的是本地访问,localhost/127.0.0.1,如果你想要你使用不同的 IP 地址访问需要把你的 ip 地址加进去,下面是我的配置,不知你的是不是这个问题,可以参考一下哈

    if (YII_ENV_DEV) {

    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
    'class' => 'yii\debug\Module',
    // uncomment the following to add your IP if you are not connecting from localhost.
    'allowedIPs' => ['127.0.0.1','192.168.56.*', '::1'],
    ];

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
    'class' => 'yii\gii\Module',
    // uncomment the following to add your IP if you are not connecting from localhost.
    'allowedIPs' => ['127.0.0.1','192.168.56.*', '::1'],
    ];
    }
    encro
        3
    encro  
       2019-03-29 17:28:54 +08:00
    1,index.php 的 YII_DEBUG 设置为 true
    2,allowedIPs 设置
    3,layout/main.php 需要加载资源
    欢迎加入 Yii 中国。
    JasonTsang
        4
    JasonTsang  
    OP
       2019-03-29 21:01:21 +08:00
    @encro layout/main.php 要加载什么资源?求代码。。。为什么文档完全没有写?
    jianyan74
        5
    jianyan74  
       2019-03-29 21:47:09 +08:00
    https://github.com/jianyan74/rageframe2 这里有很多案例你可以看下
    yoshiyuki
        6
    yoshiyuki  
       2019-03-30 16:22:29 +08:00
    @encro 同问,layout/main.php 应该载入什么东西
    encro
        7
    encro  
       2019-03-31 18:44:59 +08:00
    要加载 assets,bootstrap,yii,debug 的的,你看下静态资源里面有加载吗?
    @JasonTsang
    @yoshiyuki
    ywisax
        8
    ywisax  
       2019-04-04 01:03:58 +08:00
    你的 view,应该类似这样才行

    ```
    <?php
    $this->beginPage();
    $this->head();
    $this->beginBody();
    $this->endBody();
    $this->endPage();

    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3502 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:53 · PVG 12:53 · LAX 21:53 · JFK 00:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.