1

我正在尝试一个 restfull 控制器,但是以这种方式绑定两个 url 似乎不再起作用了。这个怎么处理最好?

// in the routes file

Route::get('/,new',array('as'=>'new_bit','uses'=>'BitsController@getNew'));

Route::controller('bits','BitsController');


// the controller
class BitsController extends BaseController {

    public $restful = true;

    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function getIndex()
    {
        return "this is the bits controller";
    }

    public function getNew()
    {
        return "this is the new page";
    }
}
4

1 回答 1

1

Laravel4 的解决方案感谢 Irc 上的JasonLewis

Route::get('/{new?}', array('as' => 'new_bit', 'uses' => 'BitsController@getNew'))->where('new', 'new'); 
于 2013-07-10T11:09:02.737 回答