mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
取消controller的config方法
This commit is contained in:
@@ -18,14 +18,11 @@ class Controller
|
|||||||
use \traits\controller\view;
|
use \traits\controller\view;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制器参数
|
* 前置操作方法列表
|
||||||
* @var config
|
* @var beforeActionList
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
protected $config = [
|
protected $beforeActionList = [];
|
||||||
// 前置操作方法
|
|
||||||
'before_action_list' => [],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 架构函数 初始化视图类 并采用内置模板引擎
|
* 架构函数 初始化视图类 并采用内置模板引擎
|
||||||
@@ -34,15 +31,13 @@ class Controller
|
|||||||
*/
|
*/
|
||||||
public function __construct($config = [])
|
public function __construct($config = [])
|
||||||
{
|
{
|
||||||
// 模板引擎参数
|
|
||||||
$this->config(empty($config) ? Config::get() : $config);
|
|
||||||
// 控制器初始化
|
// 控制器初始化
|
||||||
if (method_exists($this, '_initialize')) {
|
if (method_exists($this, '_initialize')) {
|
||||||
$this->_initialize();
|
$this->_initialize();
|
||||||
}
|
}
|
||||||
// 前置操作方法
|
// 前置操作方法
|
||||||
// 支持 ['action1','action2'] 或者 ['action1'=>['only'=>'index'],'action2'=>['except'=>'login']]
|
// 支持 ['action1','action2'] 或者 ['action1'=>['only'=>'index'],'action2'=>['except'=>'login']]
|
||||||
$list = $this->config['before_action_list'];
|
$list = $this->beforeActionList;
|
||||||
if ($list) {
|
if ($list) {
|
||||||
foreach ($list as $method => $options) {
|
foreach ($list as $method => $options) {
|
||||||
is_numeric($method) ?
|
is_numeric($method) ?
|
||||||
@@ -52,24 +47,6 @@ class Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置控制器参数
|
|
||||||
* @access public
|
|
||||||
* @param array $config 视图参数
|
|
||||||
* @return Think\Controller
|
|
||||||
*/
|
|
||||||
public function config($config = [])
|
|
||||||
{
|
|
||||||
if (is_array($config)) {
|
|
||||||
foreach ($this->config as $key => $val) {
|
|
||||||
if (isset($config[$key])) {
|
|
||||||
$this->config[$key] = $config[$key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 前置操作
|
* 前置操作
|
||||||
* @access protected
|
* @access protected
|
||||||
|
|||||||
Reference in New Issue
Block a user