laravel9提示“Target*classControllerdoesnotexist”如何解决-成都快上网建站

laravel9提示“Target*classControllerdoesnotexist”如何解决

这篇文章主要介绍“laravel9提示“Target *classController does not exist”如何解决”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“laravel9提示“Target *classController does not exist”如何解决”文章能帮助大家解决问题。

成都创新互联公司基于成都重庆香港及美国等地区分布式IDC机房数据中心构建的电信大带宽,联通大带宽,移动大带宽,多线BGP大带宽租用,是为众多客户提供专业服务器托管报价,主机托管价格性价比高,为金融证券行业成都服务器托管,ai人工智能服务器托管提供bgp线路100M独享,G口带宽及机柜租用的专业成都idc公司。

关于 laravel 9 api 提示 Target class [App\\Http\\Controllers\\CaptchasController] does not exist 解决方法

1. 打开 app\Providers\RouteServiceProvider.php 

class RouteServiceProvider extends ServiceProvider
{
   .
   .
   .
   .
   .
   protected $namespace ='App\\Http\\Controllers';
  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. 打开 app\Providers\RouteServiceProvider.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 () {
            });
    })

关于“laravel9提示“Target *classController does not exist”如何解决”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注创新互联行业资讯频道,小编每天都会为大家更新不同的知识点。


当前题目:laravel9提示“Target*classControllerdoesnotexist”如何解决
文章源于:http://kswjz.com/article/iioodc.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流