yii2怎么訪問debug

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

<?php   $localConfig = [     &#39;components&#39; =>?[ ????????'log'?=&gt;?[ ????????????'traceLevel'?=&gt;?YII_DEBUG???3?:?0, ????????????'targets'?=&gt;?[ ????????????????[ ????????????????????'class'?=&gt;?'yiilogFileTarget', ????????????????????'levels'?=&gt;?['error',?'warning'], ????????????????], ????????????], ????????], ????], ]; ? if?(YII_ENV_DEV)?{ ????//?configuration?adjustments?for?'dev'?environment ????$localConfig['bootstrap'][]?=?'debug'; ????$localConfig['modules']['debug']?=?[ ????????'class'?=&gt;?'yiidebugModule', ????????//?uncomment?the?following?to?add?your?IP?if?you?are?not?connecting?from?localhost. ????????//'allowedIPs'?=&gt;?['127.0.0.1',?'::1'], ????????'allowedIPs'?=&gt;?['*'], ????]; ? ????$localConfig['bootstrap'][]?=?'gii'; ????$localConfig['modules']['gii']?=?[ ????????'class'?=&gt;?'yiigiiModule', ????????//?uncomment?the?following?to?add?your?IP?if?you?are?not?connecting?from?localhost. ????????//'allowedIPs'?=&gt;?['127.0.0.1',?'::1'], ????]; } ? return?$localConfig;

5.設置runtime目錄為可讀寫

? 版權聲明
THE END
喜歡就支持一下吧
點贊8 分享