Permalink
Browse files

修正控制器调用

  • Loading branch information...
liu21st committed Dec 9, 2018
1 parent 4c2b06e commit 802f284bec821a608e7543d91126abc5901b2815
Showing with 6 additions and 1 deletion.
  1. +6 −1 library/think/route/dispatch/Module.php
@@ -67,7 +67,12 @@ public function init()
// 是否自动转换控制器和操作名
$convert = is_bool($this->convert) ? $this->convert : $this->rule->getConfig('url_convert');
// 获取控制器名
$controller = strip_tags($result[1] ?: $this->rule->getConfig('default_controller'));
$controller = strip_tags($result[1] ?: $this->rule->getConfig('default_controller'));
if (!preg_match('/^[A-Za-z](\w)*$/', $controller)) {
throw new HttpException(404, 'controller not exists:' . $controller);
}
$this->controller = $convert ? strtolower($controller) : $controller;
// 获取操作名

10 comments on commit 802f284

@hoshn

This comment has been minimized.

Copy link

hoshn replied Dec 11, 2018

ths

@aixwlove

This comment has been minimized.

Copy link

aixwlove replied Dec 11, 2018

欧了

@lion1120lion

This comment has been minimized.

Copy link

lion1120lion replied Dec 11, 2018

欧了

@liuwave

This comment has been minimized.

Copy link

liuwave replied Dec 11, 2018

确认升级到 5.1.31了,library/think/route/dispatch/Module.php 这里的代码还是修复之前的呢?
没有这段:` $controller = strip_tags($result[1] ?: $this->rule->getConfig('default_controller'));

     if (!preg_match('/^[A-Za-z](\w)*$/', $controller)) {
         throw new HttpException(404, 'controller not exists:' . $controller);
     }`
@liu21st

This comment has been minimized.

Copy link
Member

liu21st replied Dec 11, 2018

@liuwave 最新代码不是在Module里面 而是在Url调度类里面

@liuwave

This comment has been minimized.

Copy link

liuwave replied Dec 11, 2018

在module里影响不大吧? 我不想再更新了,好多项目,难得弄..... @liu21st

@liu21st

This comment has been minimized.

Copy link
Member

liu21st replied Dec 11, 2018

@liuwave 不影响,只是Url里面更合理 没定义路由走的是Url 定义了路由走Module 是不需要检测的

@liu21st

This comment has been minimized.

Copy link
Member

liu21st replied Dec 11, 2018

但一定要按照 官方最新的公告来修正 你的代码还遗漏了一处的

@liuwave

This comment has been minimized.

Copy link

liuwave replied Dec 11, 2018

昨天升级的和今天早上升级的项目都是在Module里面,已经是5.1.31了,没有关系的话,我就不再重新升级了,等下次更新再弄。

@wangdasheng

This comment has been minimized.

Copy link

wangdasheng replied Dec 22, 2018

@liu21st 官方最新的公告在哪看?

Please sign in to comment.