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

這篇文章主要介紹“l(fā)aravel9提示“Target *classController does not exist”如何解決”的相關(guān)知識,小編通過實(shí)際案例向大家展示操作過程,操作方法簡單快捷,實(shí)用性強(qiáng),希望這篇“l(fā)aravel9提示“Target *classController does not exist”如何解決”文章能幫助大家解決問題。

成都創(chuàng)新互聯(lián)公司基于成都重慶香港及美國等地區(qū)分布式IDC機(jī)房數(shù)據(jù)中心構(gòu)建的電信大帶寬,聯(lián)通大帶寬,移動大帶寬,多線BGP大帶寬租用,是為眾多客戶提供專業(yè)服務(wù)器托管報(bào)價(jià),主機(jī)托管價(jià)格性價(jià)比高,為金融證券行業(yè)成都服務(wù)器托管,ai人工智能服務(wù)器托管提供bgp線路100M獨(dú)享,G口帶寬及機(jī)柜租用的專業(yè)成都idc公司。

關(guān)于 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

<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
//use App\Http\Controllers\Api\CaptchasController;
Route::prefix('v1')
    ->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 () {
            });
    })

關(guān)于“l(fā)aravel9提示“Target *classController does not exist”如何解決”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,小編每天都會為大家更新不同的知識點(diǎn)。

當(dāng)前名稱:laravel9提示“Target*classControllerdoesnotexist”如何解決
文章網(wǎng)址:http://muchs.cn/article12/iioodc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、網(wǎng)站策劃、ChatGPT、手機(jī)網(wǎng)站建設(shè)、做網(wǎng)站、商城網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

營銷型網(wǎng)站建設(shè)