yii2怎么访问debug

互联网 20-3-11

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

<?php   $localConfig = [     'components' => [         '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的详细内容,更多内容请关注技术你好其它相关文章!

来源链接:
免责声明:
1.资讯内容不构成投资建议,投资者应独立决策并自行承担风险
2.本文版权归属原作所有,仅代表作者本人观点,不代表本站的观点或立场
标签: debug
上一篇:php获取远程图片并下载保存到本地的方法分析 下一篇:yii框架怎么使用twig模板引擎

相关资讯