首页 > 学院 > 开发设计 > 正文

yii2设置网站基础url

2019-11-08 01:50:33
字体:
来源:转载
供稿:网友

<?php$config = [    'components' => [        'request' => [            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation            'cookieValidationKey' => '',            'baseUrl' => 'http://testadmin.website.com/',        ],    ],    'defaultRoute' => 'form-info',];if (!YII_ENV_TEST) {    // configuration adjustments for 'dev' environment    $config['bootstrap'][] = 'debug';    $config['modules']['debug'] = [        'class' => 'yii/debug/Module',    ];    $config['bootstrap'][] = 'gii';    $config['modules']['gii'] = [        'class' => 'yii/gii/Module',    ];}return $config;上面的例子是在run/environments/dev/backend/config/main-local.php中设置后台基础url,设置baseurl参数即可,设置前台基础url以此类推


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表