视频网站如何优化,狐表做网站,互联网技术应用就业方向,seo公司优化排名Laravel10中提示了Target *classController does not exist#xff0c;为什么呢#xff1f; 原因是#xff1a;laravel8开始写法变了。换成了新的写法了 解决方法一#xff1a; 在路由数组加入App\Http\Controllers\即可。 ?phpuse Illuminate\Support\Facades\Route;…Laravel10中提示了Target *classController does not exist为什么呢 原因是laravel8开始写法变了。换成了新的写法了 解决方法一 在路由数组加入App\Http\Controllers\即可。 ?phpuse Illuminate\Support\Facades\Route;Route::get(/, [App\Http\Controllers\IndexController::class, index])-name(admin.index.index);?
再次访问URL搞定。
解决方法二
打开 app\Providers\RouteServiceProvider.php 修改,添加一个namespace变量
?phpnamespace App\Providers;use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;class RouteServiceProvider extends ServiceProvider
{/*** The path to the home route for your application.** Typically, users are redirected here after authentication.** var string*/public const HOME /home;/************此处添加*START**********************/ protected $namespace App\Http\\Controllers\\Api;/************此处添加*END**********************//*** Define your route model bindings, pattern filters, and other route configuration.** return void*/public function boot(){$this-configureRateLimiting();$this-routes(function () {Route::middleware(api)-prefix(api)/************此处添加*START**********************/ -namespace($this-namespace)/************此处添加*END**********************/-group(base_path(routes/api.php));Route::middleware(web)-group(base_path(routes/web.php));});}/*** Configure the rate limiters for the application.** return void*/protected function configureRateLimiting(){RateLimiter::for(api, function (Request $request) {return Limit::perMinute(60)-by($request-user()?-id ?: $request-ip());});}
}