我有基础版本。我阅读了文章http://www.yiiframework.com/doc-2.0/yii-debug-module.html但我不明白在哪个文件中插入代码,其中包括调试?
查了一下资料,发现在 config/web.php 里面的 debug 在 YII_ENV_DEV 部分是这样写的:
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' => ['85.89.139.124'],
];
$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', '::1'],
];
}
Run Code Online (Sandbox Code Playgroud)
应用程序/网络/index.php
<?php
defined('YII_DEBUG') …Run Code Online (Sandbox Code Playgroud) 我插入一个条目,其中有主键的重复项。
public function actionInc()
{
$add = new Country();
$add->code = 'QI';
$add->name = 'Qiang';
$add->population = '4444444';
try {
$add->save();
return $this->render('inc', [
'count' => 'Ok',
]);
} catch (Exception $exception) {
return $this->render('inc', [
'count' => 'Error',
]);
}
}
Run Code Online (Sandbox Code Playgroud)
但我需要该应用程序不关闭,并继续工作,但不起作用...
