【发布时间】:2014-04-11 21:08:31
【问题描述】:
在 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:http://www.domain.com/laravel/public/cat/edit,它返回:
显示猫号:编辑
为什么会返回显示函数内容?!
【问题讨论】:
标签: laravel-4