重新初始化
This commit is contained in:
37
app/controller/Base.php
Normal file
37
app/controller/Base.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller;
|
||||
|
||||
use app\BaseController;
|
||||
use think\facade\View;
|
||||
|
||||
class Base extends BaseController {
|
||||
|
||||
use \liliuwei\think\Jump;
|
||||
|
||||
// 使用内置PHP模板引擎渲染模板输出
|
||||
protected $tpl_config = [
|
||||
'view_dir_name' => 'public' . DIRECTORY_SEPARATOR . 'template',
|
||||
'tpl_replace_string' => [
|
||||
'__static__' => '/static',
|
||||
'__img__' => '/static/front/images',
|
||||
'__css__' => '/static/front/css',
|
||||
'__js__' => '/static/front/js',
|
||||
'__public__' => '/static/front',
|
||||
],
|
||||
];
|
||||
|
||||
public $data = []; //渲染数据
|
||||
|
||||
protected function fetch($template = '') {
|
||||
View::config($this->tpl_config);
|
||||
View::assign($this->data);
|
||||
View::fetch($template);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user