zm
2021-04-02 d6aa91642bb270e8309831d85aa1e7e09629e4da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
 * Created by IntelliJ IDEA.
 * User: luwei
 * Date: 2019/4/15
 * Time: 15:54
 */
 
namespace app\controllers;
 
 
use app\forms\install\InstallForm;
use yii\web\ForbiddenHttpException;
 
class InstallController extends Controller
{
    public $layout = 'install';
 
    public function actionIndex()
    {
        if (is_we7()) {
            throw new ForbiddenHttpException('禁止访问。');
            return;
        }
        if (file_exists(\Yii::$app->basePath . '/install.lock')) {
            throw new ForbiddenHttpException('禁止访问。');
            return;
        }
        if (\Yii::$app->request->isAjax) {
            if (\Yii::$app->request->isPost) {
                $form = new InstallForm();
                $form->attributes = \Yii::$app->request->post();
                return $form->install();
            }
        } else {
            return $this->render('index');
        }
    }
}