Questions tagged «laravel-8»

14
目标类控制器不存在-Laravel 8
这是我的控制器: <?php namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use Illuminate\Http\Request; class RegisterController extends Controller { public function register(Request $request) { dd('aa'); } } 如屏幕截图所示,该类存在且位于正确的位置: 我的api.php路线: Route::get('register', 'Api\RegisterController@register'); 当我register使用邮递员到达路线时,出现以下错误: 目标类[Api \ RegisterController]不存在。 更新: 多亏了答案,我才得以解决。我决定为此路线使用完全限定的类名,但是答案中还介绍了其他选项。 Route::get('register', 'App\Http\Controllers\Api\RegisterController@register');
80 php  laravel  laravel-8 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.