RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^admin(/.*)?$ backend/web/$1 [L]
# handle the case of frontend
RewriteCond %{REQUEST_URI} ^/
RewriteRule ^(.*)$ frontend/web/$1 [L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
<?php
$params = array_merge(
require __DIR__ . '/../../common/config/params.php',
require __DIR__ . '/../../common/config/params-local.php',
require __DIR__ . '/params.php',
require __DIR__ . '/params-local.php'
);
return [
'id' => 'app-frontend',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'frontend\controllers',
'components' => [
'request' => [
'csrfParam' => '_csrf-frontend',
'baseUrl'=> '/yii2.loc',
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
],
'session' => [
// this is the name of the session cookie used for login on the frontend
'name' => 'advanced-frontend',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
],
'params' => $params,
];
<?php
use yii\web\Request;
$baseUrl = str_replace('/backend/web', '/admin', (new Request())->getBaseUrl());
$config = [
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 't1CCuYEwMXr8vHADv4ndbasQEK5dR57s',
'baseUrl' => $baseUrl
],
],
];
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;
<?php
use yii\web\Request;
$baseUrl = str_replace('/backend/web', '/admin', (new Request())->getBaseUrl());
$params = array_merge(
require __DIR__ . '/../../common/config/params.php',
require __DIR__ . '/../../common/config/params-local.php',
require __DIR__ . '/params.php',
require __DIR__ . '/params-local.php'
);
return [
'id' => 'app-backend',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'],
'modules' => [],
'components' => [
'request' => [
'csrfParam' => '_csrf-backend',
'baseUrl' => $baseUrl
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
],
'session' => [
// this is the name of the session cookie used for login on the backend
'name' => 'advanced-backend',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
],
'params' => $params,
];
<?php if( !empty($hits) ): ?>
<?php foreach($hits as $hit): ?>
<?=$name2=$hit->naim ?>
<p><input type="radio" name="name1" value="Раз в неделю"><?=$hit->perot ?> </p>
<p><input type="radio" name="name1" value="Раз в месяц "><?=$hit->wtorot ?> </p>
<p><input type="radio" name="name1" value="По праздникам "><?=$hit->tretot ?> </p>
<li><a href="<?= \yii\helpers\Url::to(['site/dob', 'name2' => $name2,'name1' => $name1])?>" "><i class="fa fa-plus-square"></i>Ответить</a></li>
<?php endforeach;?>
<?php endif; ?>
$name2 = Yii::$app->request->get('name2');
<a href="<?= \yii\helpers\Url::to(['site/dob', 'name2' => $name2,'name1' => $name1])?>" "><i class="fa fa-plus-square"></i>Ответить</a>
<?php if( !empty($hits) ): ?>
<?php foreach($hits as $hit): ?>
<?=$name2=$hit->naim ?>
<p><input type="radio" name="name1" value="Раз в неделю"><?=$hit->perot ?> </p>
<p><input type="radio" name="name1" value="Раз в месяц "><?=$hit->wtorot ?> </p>
<p><input type="radio" name="name1" value="По праздникам "><?=$hit->tretot ?> </p>
<li><a href="<?= \yii\helpers\Url::to(['site/dob', 'name2' => $name2,'name1' => $name1])?>" "><i class="fa fa-plus-square"></i>Ответить</a></li>
<?php endforeach;?>
<?php endif; ?> -это вывод данных с другой таблицы wopr
An Error occurred while handling another error:
yii\base\InvalidRouteException: Unable to resolve the request: site/error in W:\domains\localhost\test3\vendor\yiisoft\yii2\base\Controller.php:128
Stack trace:
#0 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('error', Array)
#1 W:\domains\localhost\test3\vendor\yiisoft\yii2\web\ErrorHandler.php(108): yii\base\Module->runAction('site/error')
#2 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\web\BadRequestHttpException))
#3 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\BadRequestHttpException))
#4 {main}
Previous exception:
yii\web\BadRequestHttpException: Отсутствуют обязательные параметры: name1 in W:\domains\localhost\test3\vendor\yiisoft\yii2\web\Controller.php:149
Stack trace:
#0 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\InlineAction.php(51): yii\web\Controller->bindActionParams(Object(yii\base\InlineAction), Array)
#1 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#2 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('dob', Array)
#3 W:\domains\localhost\test3\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('site/dob', Array)
#4 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))
#5 W:\domains\localhost\test3\frontend\web\index.php(18): yii\base\Application->run()
#6 {main}
An Error occurred while handling another error:
yii\base\InvalidRouteException: Unable to resolve the request: site/error in W:\domains\localhost\test3\vendor\yiisoft\yii2\base\Controller.php:128
Stack trace:
#0 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('error', Array)
#1 W:\domains\localhost\test3\vendor\yiisoft\yii2\web\ErrorHandler.php(108): yii\base\Module->runAction('site/error')
#2 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\web\BadRequestHttpException))
#3 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\BadRequestHttpException))
#4 {main}
Previous exception:
yii\web\BadRequestHttpException: Отсутствуют обязательные параметры: name1 in W:\domains\localhost\test3\vendor\yiisoft\yii2\web\Controller.php:149
Stack trace:
#0 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\InlineAction.php(51): yii\web\Controller->bindActionParams(Object(yii\base\InlineAction), Array)
#1 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#2 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('dob', Array)
#3 W:\domains\localhost\test3\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('site/dob', Array)
#4 W:\domains\localhost\test3\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))
#5 W:\domains\localhost\test3\frontend\web\index.php(18): yii\base\Application->run()
#6 {main}