一、设置YII项目密钥
文件在于yii=》config=》web.php
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'components' => [
'request' => [
'cookieValidationKey' => '用户所填密钥',
],
];
二、GII快速生成代码
1.配置GII
文件在于yii=》config=》web.php
if (YII_ENV_DEV) {
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = 'yii\gii\Module';
}
该配置意思是当项目处于开发模式时,包含GII模块,模块类是 [[yii\gii\Module]]。
2.访问方法
http://域名/yii/web/index.php?r=gii