路由增加参数数字规则 输入字母就提示找不到模型

浏览:490 发布日期:2022/03/31 分类:求助交流
诸位, 刚开始学习thinkPHP, 帮忙看下这个怎么解决, 折腾了好久排除不了.

用的是tp5.1官方的
使用参数规则验证触发 "模块不存在:about" 的http异常.
一但注释掉pattern()不验证了才能正常访问.

默认用的是多模块
在config/Route.php增加// id参数必须是数字规则
Route::get('about/:id', 'index/Home/about')->pattern('id', '\d+');
浏览器地址 sss为参数
http://syhs.local.com/about/sss.html

------------------------------------------------------------------------

编辑器内和附件上传图片都传不了, 只能复制粘贴了.


[0] HttpException in Module.php line 62
模块不存在:about                $available = true;
            }

            // 模块初始化
            if ($module && $available) {
                // 初始化模块
                $this->request->setModule($module);
                $this->app->init($module);
            } else {
                throw new HttpException(404, 'module not exists:' . $module);
            }
        }

        // 是否自动转换控制器和操作名
        $convert = is_bool($this->convert) ? $this->convert : $this->rule->getConfig('url_convert');
        // 获取控制器名
        $controller = strip_tags($result[1] ?: $this->rule->getConfig('default_controller'));

        $this->controller = $convert ? strtolower($controller) : $controller;
最佳答案
评论( 相关
后面还有条评论,点击查看>>