1、thinkphp\library\think\Request.php

        public function method($method = false)
改为
    public function method($method = false)
    {
        if (true === $method) {
            // 获取原始请求类型
            return $this->server('REQUEST_METHOD') ?: 'GET';
        } elseif (!$this->method) {
            if (isset($_POST[Config::get('var_method')])) {
                $method = strtoupper($_POST[Config::get('var_method')]);
                if (in_array($method, ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'])) {
                    $this->method = $method;
                    $this->{$this->method}($_POST);
                } else {
                    $this->method = 'POST';
                }
                unset($_POST[Config::get('var_method')]);
            } elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
                $this->method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
            } else {
                $this->method = $this->server('REQUEST_METHOD') ?: 'GET';
            }
        }
        return $this->method;
    }

2、thinkphp\library\think\App.php

public static function module(
        // 获取控制器名
        $controller = strip_tags($result[1] ?: $config['default_controller']);
改为
                // 获取控制器名
        $controller = strip_tags($result[1] ?: $config['default_controller']);

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

3、thinkphp\library\think\Route.php

public static function parseUrl
                    // 解析控制器
              $controller = !empty($path) ? array_shift($path) : null;
          }
改为
                // 解析控制器
                $controller = !empty($path) ? array_shift($path) : null;
            }
            if ($controller && !preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) {
                throw new HttpException(404, 'controller not exists:' . $controller);
            }

标签: none

添加新评论