解决?TP5绑定模块以后无法使用验证码

浏览:3292 发布日期:2016/09/30 分类:ThinkPHP5专区
vendor\topthink\think-captcha\src中定义了验证码路由器\think\Route::get('captcha/[:id]', "\\think\\captcha\\CaptchaController@index");于是请求 http://localhost/captcha 便能调取验证码的控制器方法

然而如果使用了模块绑定或域名路由 ,若绑定index模块,那么访问
http://localhost/captcha
实际上等同于访问
http://localhost/index/captcha
因此匹配不上验证码控制器

修改方法:
在route.php中手动添加\think\Route::get('AAAAA/captcha/[:id]', "\\think\\captcha\\CaptchaController@index");其中AAAAA是你绑定的模块名.


看了一下代码 TP首先会根据绑定模块进行请求追加
然后再进行域名判定
最佳答案
评论( 相关
后面还有条评论,点击查看>>