Laravel 5.2 类 不存在
Laravel 5.2 Classes do not exist
问题:
我的 Laravel 5.2 应用程序出错,调用 class 方法导致 Laravel 无法找到 class.
我运行一个LAMP-stack.
我已经尝试了各种建议,许多人都偶然发现命名空间作为解决方案。我是 Laravel 的新手,所以可能有一些基本设置我做错了。 我主要研究了文件夹所有权和权限。
我在调用库提供的不同控制器时也遇到过这个问题。但是,我不确定描述这个问题是否会混淆真正的问题。
我的错误:
Route.php 第 264 行中的 ReflectionException:
Class App\Http\Controllers\SteamInventory 不存在
- 在 Route.php 行 264
- 于
ReflectionMethod->__construct('App\Http\Controllers\SteamInventory',
'getInventory') 在 Route.php 第 264 行
- 在路由->signatureParameters('Illuminate\Database\Eloquent\Model')
在 Router.php 第 859 行
- 在 Router.php 中的 Router->substituteImplicitBindings(object(Route))
第 844 行
- 在 Router->substituteBindings(object(Route)) 在 Router.php line 827
- 在 Router.php 第 691 行
中的 Router->findRoute(object(Request))
- 在 Router.php 第 675 行
中的 Router->dispatchToRoute(object(Request))
- 在 Kernel.php 第 246 行
中的 Router->dispatch(object(Request))
- 在内核->Illuminate\Foundation\Http{闭包}(对象(请求))
- 在call_user_func(对象(关闭),对象(请求))在Pipeline.php
第 52 行
- 在 Pipeline->Illuminate\Routing{closure}(object(Request)) in
CheckForMaintenanceMode.php 第 44 行
- 在 CheckForMaintenanceMode->handle(object(Request),
对象(闭包))
- 在call_user_func_array(数组(对象(CheckForMaintenanceMode),
'handle'), array(object(Request), object(Closure))) in Pipeline.php
第 124 行
- 在管道->Illuminate\Pipeline{闭包}(对象(请求))
- 在call_user_func(对象(关闭),对象(请求))在Pipeline.php
第 32 行
- 在管道->Illuminate\Routing{闭包}(对象(请求))
- 在call_user_func(对象(关闭),对象(请求))在Pipeline.php
第 103 行
- 在 Pipeline->then(object(Closure)) 在 Kernel.php line 132
- 在 Kernel.php 中的内核->sendRequestThroughRouter(object(Request))
第 99 行
- 在 index.php 第 54 行
中的内核->handle(object(Request))
我的路线在/app/Http/routes.php
Route::group(['middleware' => ['auth']], function () {
Route::get('trades', 'SteamInventory@getInventory');
});
我的控制器在 /app/Http/Controllers/SteamInventoryController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
class SteamInventoryController extends Controller
{
public function getInventory () {
return "test";
}
}
改变这个
SteamInventory
对此
SteamInventoryController
在这个
Route::get('trades', 'SteamInventory@getInventory');
更改路线
Route::get('trades', 'SteamInventory@getInventory');
到
Route::get('trades', 'SteamInventoryController@getInventory');
问题:
我的 Laravel 5.2 应用程序出错,调用 class 方法导致 Laravel 无法找到 class.
我运行一个LAMP-stack.
我已经尝试了各种建议,许多人都偶然发现命名空间作为解决方案。我是 Laravel 的新手,所以可能有一些基本设置我做错了。 我主要研究了文件夹所有权和权限。
我在调用库提供的不同控制器时也遇到过这个问题。但是,我不确定描述这个问题是否会混淆真正的问题。
我的错误:
Route.php 第 264 行中的 ReflectionException: Class App\Http\Controllers\SteamInventory 不存在
- 在 Route.php 行 264
- 于 ReflectionMethod->__construct('App\Http\Controllers\SteamInventory', 'getInventory') 在 Route.php 第 264 行
- 在路由->signatureParameters('Illuminate\Database\Eloquent\Model') 在 Router.php 第 859 行
- 在 Router.php 中的 Router->substituteImplicitBindings(object(Route)) 第 844 行
- 在 Router->substituteBindings(object(Route)) 在 Router.php line 827
- 在 Router.php 第 691 行 中的 Router->findRoute(object(Request))
- 在 Router.php 第 675 行 中的 Router->dispatchToRoute(object(Request))
- 在 Kernel.php 第 246 行 中的 Router->dispatch(object(Request))
- 在内核->Illuminate\Foundation\Http{闭包}(对象(请求))
- 在call_user_func(对象(关闭),对象(请求))在Pipeline.php 第 52 行
- 在 Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php 第 44 行
- 在 CheckForMaintenanceMode->handle(object(Request), 对象(闭包))
- 在call_user_func_array(数组(对象(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php 第 124 行
- 在管道->Illuminate\Pipeline{闭包}(对象(请求))
- 在call_user_func(对象(关闭),对象(请求))在Pipeline.php 第 32 行
- 在管道->Illuminate\Routing{闭包}(对象(请求))
- 在call_user_func(对象(关闭),对象(请求))在Pipeline.php 第 103 行
- 在 Pipeline->then(object(Closure)) 在 Kernel.php line 132
- 在 Kernel.php 中的内核->sendRequestThroughRouter(object(Request)) 第 99 行
- 在 index.php 第 54 行 中的内核->handle(object(Request))
我的路线在/app/Http/routes.php
Route::group(['middleware' => ['auth']], function () {
Route::get('trades', 'SteamInventory@getInventory');
});
我的控制器在 /app/Http/Controllers/SteamInventoryController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
class SteamInventoryController extends Controller
{
public function getInventory () {
return "test";
}
}
改变这个
SteamInventory
对此
SteamInventoryController
在这个
Route::get('trades', 'SteamInventory@getInventory');
更改路线
Route::get('trades', 'SteamInventory@getInventory');
到
Route::get('trades', 'SteamInventoryController@getInventory');