首页 > php框架 > > 正文

yii2怎么访问debug

王林
发布: 2020-03-11 13:52:53
原创
2853 人浏览过

yii2怎么访问debug

1.项目安装debug工具

php composer.phar require --prefer-dist yiisoft/yii2-debug
登录后复制

2.配置web/index.php

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
登录后复制

3.配置config/web.php

if(file_exists(__DIR__ . "/web-local.php")) {
    $localConfig = require __DIR__ . "/web-local.php";
    $config = ArrayHelper::merge($config, $localConfig);
}
登录后复制

(相关教程推荐:yii框架

4.增加web-local.php

 [
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
    ],
];
 
if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $localConfig['bootstrap'][] = 'debug';
    $localConfig['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', '::1'],
        'allowedIPs' => ['*'],
    ];
 
    $localConfig['bootstrap'][] = 'gii';
    $localConfig['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', '::1'],
    ];
}
 
return $localConfig;
登录后复制

5.设置runtime目录为可读写

以上是yii2怎么访问debug的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!