gpt4 book ai didi

Laravel 4.2 - 反射异常 (-1)

转载 作者:行者123 更新时间:2023-12-02 03:33:14 25 4
gpt4 key购买 nike

我收到以下错误:

ReflectionException (-1)

Class PhotosController does not exist

这是我的路线:

Route::resource('photos', ' PhotosController');

当我更改为 Route::get('photos', 'PhotosController@index'); 时它工作正常,但是使用 resource 它正在下降?到底是怎么回事?照片 Controller :

<?php

class PhotosController extends \BaseController {

/**
* Display a listing of the resource.
* GET /photos
*
* @return Response
*/
public function index()
{
return Photo::all();
}

/**
* Show the form for creating a new resource.
* GET /photos/create
*
* @return Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
* POST /photos
*
* @return Response
*/
public function store()
{
//
}

/**
* Display the specified resource.
* GET /photos/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}

/**
* Show the form for editing the specified resource.
* GET /photos/{id}/edit
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}

/**
* Update the specified resource in storage.
* PUT /photos/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
}

/**
* Remove the specified resource from storage.
* DELETE /photos/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}

}

最佳答案

如果 composer dump-autoload 没有修复它,那么它可能是类名或路由文件中的拼写错误,或者在 Controller 上错误地使用了子目录/命名空间。

关于Laravel 4.2 - 反射异常 (-1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25428645/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com