yii2如何开启debug

互联网 19-11-6

yii2如何开启debug

1、 在web/index.php文件中添加下面两行代码:

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

2、打开yii config目录下的web.php文件,找到如下配置

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'],     ]; }

推荐:《YII教程》

以上就是yii2如何开启debug的详细内容,更多内容请关注技术你好其它相关文章!

来源链接:
免责声明:
1.资讯内容不构成投资建议,投资者应独立决策并自行承担风险
2.本文版权归属原作所有,仅代表作者本人观点,不代表本站的观点或立场
标签: 开启debug
上一篇:php获取远程图片并下载保存到本地的方法分析 下一篇:yii2写api接口步骤

相关资讯