1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace app\install\controller;
- use core\base\BaseController;
- use think\App;
- use think\facade\View;
- class BaseInstall extends BaseController
- {
- public $replace = [];
- public $lock_file;
- public $lang;
- public $install_root = '';
- public function __construct(App $app)
- {
- parent::__construct($app);
- $this->lock_file = '../install.lock';
- $root_url = request()->domain();
- View::assign("root_url", $root_url);
- $this->setInstallRoot();
- }
-
- protected function fetch($template = '', $vars = [])
- {
- return View::fetch($template, $vars);
- }
-
- protected function assign($name, $value = '')
- {
- View::assign($name, $value);
- }
- public function setInstallRoot()
- {
- $this->install_root = dirname(__DIR__) . '/';
- }
- public function str_replace_first($search, $replace, $subject)
- {
- return implode($replace, explode($search, $subject, 2));
- }
- public function checkLock()
- {
- if (file_exists($this->lock_file)) {
- header("location:/index.php");
- exit;
- }
- }
- }
|