1

我在让 Laravel 4 路线正常工作时遇到了一些麻烦——只是无法理解我做错了什么。

我的作曲家包是最新的,我正在使用最新版本的照明/应用程序。

这是一条运行良好的路线:

GET /hello

Route::get('hello', function()
{
    return 'yey';
});

但我就是无法让第二个 uri 段作为参数传递。

这没有用:

GET /hello/1

Route::get('hello/(:num)', function($id)
{
    return 'yey ' . $id;
});

或者:

GET /hello/1

Route::get('hello/(:any)', function($id)
{
    return 'yey ' . $id;
});

最终我想要一个控制器来处理我的东西——但我只是不知道我现在做错了什么。

4

1 回答 1

3

几乎。你真的想这样做:

Route::get('hello/{num}', function($id)
{
    return 'yey ' . $id;
});
于 2013-01-07T17:27:13.097 回答