Laravel route :: controller如何处理骆驼/蛇案?

Dam*_*mon 4 routing camelcasing laravel

在routes.php中:

Route::controller('account', 'AccountController');    
Run Code Online (Sandbox Code Playgroud)

在ajax - >控制器:

POST /account/password_reset -> postPasswordReset  //not working
POST /account/passwordReset -> postPasswordReset  //not working
POST /account/password_reset -> postPassword_reset  //not working
POST /account/passwordreset -> postPasswordreset  //working
Run Code Online (Sandbox Code Playgroud)

我的印象是(并且更喜欢)第一种选择,但这并不是我的行为.这里应该发生什么?

clo*_*018 9

Laravel 4使用 - 分隔长动作名称,因此在这种情况下,您的动作将如下所示

public function postPasswordReset
Run Code Online (Sandbox Code Playgroud)

你的网址看起来像

/account/password-reset
Run Code Online (Sandbox Code Playgroud)

但是,我建议使用其中一个内置路由器URL帮助程序HTML::linkAction(),URL::action()或者如果您使用的是表单,请指定'action' => 'YourController@YourAction'

文档:http://laravel.com/docs/html#opening-a-form