Laravel 4 控制器中的路由和功能错误

Laravel 4 控制器中的路由和功能错误,laravel-4,Laravel 4,在app/routes.php文件中,我添加了Route::resource'cat'、'CatController' 这是一个CatController代码: <?php class CatController extends \BaseController { /** * Display a listing of the resource. * * @return Response */ public function ind

在app/routes.php文件中,我添加了Route::resource'cat'、'CatController'

这是一个CatController代码:

<?php

class CatController extends \BaseController {

    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
         return 'This is cat controller index.';

    }

    /**
     * Show the form for creating a new resource.
     *
     * @return Response
     */
    public function create()
    {
        //
        return 'This is a form to create new cat !';
    }

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

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function show($id)
    {
        //
        return 'Show the cat number:' . $id;
    }

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

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

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

}
当我调用url:时,它返回:

显示cat编号:编辑


为什么要返回显示功能内容

edit$id的URL模式是/resource/{id}/edit-您只是在使用/resource/edit,它被解释为/resource/{id},指向show$id方法。

当i user/public/cat/edit/4564时,它出现错误Symfony\Component\HttpKernel\Exception\notfoundhttpexception错误顺序。读一下我写的东西,也许再看一遍文档。嗯,它可以工作,但是当有一个2个带参数的函数时,它返回错误