req: Use -help for summary.
site.loc: 127.0.0.1 [21/Apr/2023:16:52:49 +0300] "GET / HTTP/1.1" 302 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 YaBrowser/23.3.2.806 Yowser/2.5 Safari/537.36"
site.loc: 127.0.0.1 [21/Apr/2023:16:52:51 +0300] "GET /login HTTP/1.1" 404 1268 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 YaBrowser/23.3.2.806 Yowser/2.5 Safari/537.36"
SSLCertificateFile "%sprogdir%/userdata/config/cert_files/rootCA.pem"
SSLCertificateKeyFile "%sprogdir%/userdata/config/cert_files/rootCA-key.pem"
mkcert -key-file key.pem -cert-file cert.pem site.loc *.site.loc
mkcert -install
<?= Html::beginForm(['/site/index'], 'post', ['class' => 'form']) ?>
<?= Html::input('text', 'name', $model->name, ['class' => 'form-control text', 'placeholder' => 'Ваше имя*']) ?>
<?= Html::input('text', 'phone', $model->phone, ['class' => 'form-control text', 'placeholder' => 'Ваш телефон*']) ?>
<?= Html::endForm() ?>
public function actionIndex()
{
$model = new Feedback();
$about = About::find()->all();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if ($model->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('success', 'Спасибо! Ваша заявка отправлена!');
} else {
Yii::$app->session->setFlash('error', 'Произошла ошибка при отправке письма. Проверьте заполненность всех полей.');
}
return $this->refresh();
} else {
return $this->render('index', compact('about', 'model'));
}
}
public function contact($adminEmail)
{
if ($this->validate()) {
Yii::$app->mailer->compose()
->setTo($adminEmail)
->setFrom([Yii::$app->params['adminEmail'] => Yii::$app->params['senderName']])
->setSubject('Заявка с сайта')
->setTextBody("Имя: ".$this->name."\n Телефон: ".$this->phone)
->send();
return true;
} else {
return false;
}
}
[php7:warn] [pid 9269] [client 127.0.0.1:52442] PHP Warning: require(/var/www/shk/web/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/shk/web/index.php on line 7, referer: http://shk/
[php7:error] [pid 9269] [client 127.0.0.1:52442] PHP Fatal error: require(): Failed opening required '/var/www/shk/web/../vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/shk/web/index.php on line 7, referer: http://shk/