本篇文章给大家带来了关于laravel的相关知识,其中主要给大家介绍在laravel9中提示了target *classcontroller does not exist,该怎么办?下面一起来看一下解决方案,希望对需要的朋友有所帮助。

关于 laravel 9 提示 Target *classController does not exist
关于 laravel 9 api 提示 Target class [AppHttpControllersCaptchasController] does not exist 解决方法
1. 打开 appProvidersRouteServiceProvider.php 修改如图
class RouteServiceProvider extends ServiceProvider{ . . . . . protected $namespace ='AppHttpControllers'; public function boot() { $this->configureRateLimiting(); $this->routes(function () { Route::middleware('api') ->prefix('api') ->namespace($this->namespace) ->group(base_path('routes/api.php')); Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/web.php')); }); }}
2. 打开 appProvidersRouteServiceProvider.php 修改如图
name('api.v1.') ->namespace("Api")//添加命名空间 ->group(function () { Route::middleware('throttle:'. config('api.rate_limits.sign')) ->group(function () { // Route::post('captchas', [CaptchasController::class, 'store'])->name('captchas.store'); ---原来的 Route::post('captchas', 'CaptchasController@store') ->name('captchas.store');// 修改成这样即可 }); Route::middleware('throttle:' .config('api.rate_limits.access')) ->group(function () { }); })
推荐学习:《laravel视频教程》
以上就是快速解决laravel9提示“Target *classController does not exist”问题!的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/65972.html
微信扫一扫
支付宝扫一扫