yii2怎么访问debug
时间:2020-03-11 13:52
1.项目安装debug工具 2.配置web/index.php 3.配置config/web.php (相关教程推荐:yii框架) 4.增加web-local.php 5.设置runtime目录为可读写 以上就是yii2怎么访问debug的详细内容,更多请关注gxlsystem.com其它相关文章!php composer.phar require --prefer-dist yiisoft/yii2-debug
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
if(file_exists(__DIR__ . "/web-local.php")) {
$localConfig = require __DIR__ . "/web-local.php";
$config = ArrayHelper::merge($config, $localConfig);
}
<?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;