Skip to content

Commit

Permalink
控制器版本移除 增加controller_load标签位
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Mar 27, 2016
1 parent bfd89ea commit 1cb86e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 0 additions & 2 deletions convention.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
'pathinfo_depr' => '/',
// 获取当前页面地址的系统变量 默认为REQUEST_URI
'url_request_uri' => 'REQUEST_URI',
// 控制器版本参数
'var_version' => 'v',
// 基础URL路径
'base_url' => $_SERVER["SCRIPT_NAME"],
// URL伪静态后缀
Expand Down
2 changes: 1 addition & 1 deletion library/think/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private static function module($result, $config)
// 安全检测
throw new Exception('illegal controller name:' . CONTROLLER_NAME, 10000);
}
$instance = Loader::controller(CONTROLLER_NAME, '', Config::get('empty_controller'), Input::get(Config::get('var_version')));
$instance = Loader::controller(CONTROLLER_NAME, '', Config::get('empty_controller'));
// 获取当前操作名
$action = ACTION_NAME . Config::get('action_suffix');

Expand Down
12 changes: 4 additions & 8 deletions library/think/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,9 @@ public static function model($name = '', $layer = MODEL_LAYER)
* @param string $name 资源地址
* @param string $layer 控制层名称
* @param string $empty 空控制器名称
* @param string $version 版本号 例如 1.0 1.2.3
* @return Object|false
*/
public static function controller($name, $layer = '', $empty = '', $version = null)
public static function controller($name, $layer = '', $empty = '')
{
static $_instance = [];
$layer = $layer ?: CONTROLLER_LAYER;
Expand All @@ -338,12 +337,9 @@ public static function controller($name, $layer = '', $empty = '', $version = nu
$module = APP_MULTI_MODULE ? MODULE_NAME : '';
}
$class = self::parseClass($module, $layer, $name);
if ($version) {
$filename = APP_PATH . str_replace(APP_NAMESPACE . '\\', '', dirname($class)) . DS . $version . DS . basename($class) . EXT;
if (is_file($filename)) {
require $filename;
}
}
// controller_load
APP_HOOK && Hook::listen('controller_load', $class);

if (class_exists($class)) {
$action = new $class;
$_instance[$name . $layer] = $action;
Expand Down

0 comments on commit 1cb86e4

Please sign in to comment.