diff --git a/app/install/controller/Index.php b/app/install/controller/Index.php index a5df831..15b0094 100644 --- a/app/install/controller/Index.php +++ b/app/install/controller/Index.php @@ -14,7 +14,7 @@ class Index extends BaseController */ // 检测是否安装过 protected function initialize(){ - if(is_file('../install.lock')){ + if(file_exists('../install.lock')){ echo ""; die(); } @@ -38,7 +38,7 @@ class Index extends BaseController } } - //test + //create public function create(){ if(Session::get('install') == 2){ Session::set('install',3); @@ -48,17 +48,18 @@ class Index extends BaseController } } - // 安装成功页面 - public function complete(){ + // 安装 + public function install(){ - if(Session::get('install') != 3){ - return redirect('./create.html'); - } + //if(Session::get('install') != 3){ + // return redirect('./create.html'); + //} // 判断是否为post - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - - $data = $_POST; + //if ($_SERVER['REQUEST_METHOD'] == 'POST') { + if(Request::isAjax()){ + $data = Request::param(); + //$data = $_POST; //var_dump($data); if (!preg_match("/^[a-zA-Z]{1}([0-9a-zA-Z]|[._]){4,19}$/", $data['admin_user'])) { die(""); @@ -194,10 +195,11 @@ php; //安装上锁 file_put_contents('../install.lock', 'lock'); Session::clear(); - return View::fetch('complete'); + //return View::fetch('complete'); + return json(['code' => 0,'msg'=>'安装成功','url'=>'/install.php/success/complete']); } else { - return '安装失败'; - } + return '请求失败!'; + } } } \ No newline at end of file diff --git a/app/install/controller/Success.php b/app/install/controller/Success.php new file mode 100644 index 0000000..998ceab --- /dev/null +++ b/app/install/controller/Success.php @@ -0,0 +1,14 @@ +run(); $response->send(); $http->end($response); +if(file_exists('../install.lock') != 'true'){ + header('Location: http://www.tp6.com/install.php'); +} \ No newline at end of file diff --git a/public/install.php b/public/install.php new file mode 100644 index 0000000..31fa17a --- /dev/null +++ b/public/install.php @@ -0,0 +1,24 @@ + +// +---------------------------------------------------------------------- + +// [ 应用入口文件 ] +namespace think; + +require __DIR__ . '/../vendor/autoload.php'; + +// 执行HTTP应用并响应 +$http = (new App())->http; + +$response = $http->run(); + +$response->send(); + +$http->end($response); \ No newline at end of file diff --git a/view/install/index/agreement.html b/view/install/index/agreement.html index b54ad14..cd70111 100644 --- a/view/install/index/agreement.html +++ b/view/install/index/agreement.html @@ -18,7 +18,7 @@ 拒绝安装
diff --git a/view/install/index/create.html b/view/install/index/create.html index d2ab97a..b5da1f7 100644 --- a/view/install/index/create.html +++ b/view/install/index/create.html @@ -3,7 +3,7 @@ {block name="body"}