Yii2 开启debug没有显示调试工具栏(线上环境)

yii2框架,开启debug后没有显示调试工具栏,线上环境不显示,但是线下是可以显示的
如图,线下显示了,线上无,代码上传到线上后,只修改了数据库配置,其他未改

clipboard.png

我在配置中web.php中配置了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', '我的IP'],  
    ];

    $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', '我的IP'],
    ];
}

阅读 9.5k
1 个回答

首先检查一下线上服务器的 web/index.php 是否确实有这两行:

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

因为一般情况下 web/index.php 是不放在版本控制中的。

另外,冒昧的问一下,'我的IP' 是公网IP吗?不是 192.168 开头的IP吧?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题