создал папку admin
в ней
assets/
config/
controllers/
models/
views/
index.php
в config сделал фаил main.php
Код: Выделить всё
<?php
$params = require(__DIR__ . '/params.php');
$config = [
'id' => 'admin',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'admin\controllers',
'bootstrap' => ['log'],
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => '123',
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => require(__DIR__ . '/../../config/db.php'),
],
'params' => $params,
];
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = 'yii\gii\Module';
}
return $config;
Код: Выделить всё
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require( __DIR__ . '/../vendor/autoload.php' );
require( __DIR__ . '/../vendor/yiisoft/yii2/Yii.php' );
$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/config/main.php')
);
$application = new yii\web\Application($config);
$application->run();
yii/admin/
получаю ошибку
Подскажите почему эта ошибкаexception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "site/error".' in /home/pehser/public_html/domein/yii/www/vendor/yiisoft/yii2/base/Module.php:461
Stack trace:
#0 /home/pehser/public_html/domein/yii/www/vendor/yiisoft/yii2/web/ErrorHandler.php(79): yii\base\Module->runAction('site/error')
#1 /home/pehser/public_html/domein/yii/www/vendor/yiisoft/yii2/base/ErrorHandler.php(95): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))
#2 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))
#3 {main}
Previous exception:
exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "".' in /home/pehser/public_html/domein/yii/www/vendor/yiisoft/yii2/base/Module.php:461
Stack trace:
#0 /home/pehser/public_html/domein/yii/www/vendor/yiisoft/yii2/web/Application.php(83): yii\base\Module->runAction('', Array)
#1 /home/pehser/public_html/domein/yii/www/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#2 /home/pehser/public_html/domein/yii/www/admin/index.php(13): yii\base\Application->run()
#3 {main}
Next exception 'yii\web\NotFoundHttpException' with message 'Unable to resolve the request "".' in /home/pehser/public_html/domein/yii/www/vendor/yiisoft/yii2/web/Application.php:95
Stack trace:
#0 /home/pehser/public_html/domein/yii/www/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#1 /home/pehser/public_html/domein/yii/www/admin/index.php(13): yii\base\Application->run()
#2 {main}