if (!empty($this->components['cache'])) {
yii::$container->set(
'cache',
['class' => $this->components['cache']['class']]
);
}
$this->cache = Yii::$container->get('cache');
$form->field($model, 'login', ['enableAjaxValidation' => true]);
if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model);
}
'urlManager'=>array(
'urlFormat'=>'path',
'baseUrl' => '/~abcd', // <-- имя вашей директории, куда перенесён проект
'rules'=>array(
// стандартное правило для обработки '/' как 'site/index'
'' => 'site/index',
'user/<action:.*>'=>'user/<action>',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
'showScriptName' => false
),
server {
listen 80;
charset utf-8;
set_real_ip_from 127.0.0.1;
real_ip_header X-Real-IP;
root /path/to/~abcd; # <-- полный путь к вашей директории, куда перенесён проект
location / {
index index.html index.php;
try_files $uri $uri/ /index.php?$args;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
#let yii catch the calls to unexising PHP files
set $fsn /index.php;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
#fastcgi_pass unix:/tmp/php-fastcgi.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
#PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
}
[['phone', 'email'], 'required',
'when' => function () {
if (!$this->phone && !$this->email) {
$this->addError('phone', 'Необходимо указать либо телефон, либо email.');
$this->addError('email', 'Необходимо указать либо телефон, либо email.');
}
},
'whenClient' => 'function (attribute, value) { return !$(\'#order-phone\').val().length && !$(\'#order-email\').val().length ;}',
'message' => Yii::t('app', 'Необходимо указать либо телефон, либо email.')
],
public function actionSuccessReg($email){
return $this->render('вьюха', ['email'=>$email]);
}