php网站怎么找控制器,php – 找不到控制器方法 – laravel 4

我有这条消息,试图运行任何控制器

Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException

Controller method not found.

我的Route文件中有此代码

Route::controller("/","HomeController");

Route::controller("users","UsersController");

和我的控制器中的代码

class UsersController extends BaseController

{

protected $layout = "layouts.main";

public function __construct()

{

$this->beforeFilter('csrf', array('on' => 'post'));

$this->beforeFilter('auth', array('only' => array('getDashboard')));

}

public function getIndex()

{

return Redirect::to("users/register");

}

public function getRegister()

{

$this->layout->content = View::make('users.register');

}

public function postCreate()

{

$validator = Validator::make(Input::all(), User::$rules);

if ($validator->passes()) {

// validation has passed, save user in DB

$user = new User;

$user->firstname = Input::get('firstname');

$user->lastname = Input::get('lastname');

$user->email = Input::get('email');

$user->password = Hash::make(Input::get('password'));

$user->save();

return Redirect::to('users/login')->with('message', 'Thanks for registering!');

} else {

return Redirect::to('users/register')->with('message', 'The following errors occurred')->withErrors($validator)->withInput();

}

}

function getLogin()

{

if (Auth::check()) return Redirect::to("users/dashboard")->with('message', 'Thanks for registering!');

$this->layout->content = View::make("users.login");

}

function postSignin()

{

if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')))) {

return Redirect::to('users/dashboard')->with('message', 'You are now logged in!');

} else {

return Redirect::to('users/login')

->with('message', 'Your username/password combination was incorrect')

->withInput();

}

}

public function getDashboard()

{

$this->layout->content = View::make("users.dashbord");

}

public function getLogout()

{

Auth::logout();

return Redirect::to('users/login')->with('message', 'Your are now logged out!');

}

我跑这个命令的呜咽

php artisan routes

+--------+------------------------------------------------------------+------+-------------------------------+----------------+---------------+

| Domain | URI | Name | Action | Before Filters | After Filters |

+--------+------------------------------------------------------------+------+-------------------------------+----------------+---------------+

| | GET index/{one?}/{two?}/{three?}/{four?}/{five?} | | HomeController@getIndex | | |

| | GET / | | HomeController@getIndex | | |

| | GET {_missing} | | HomeController@missingMethod | | |

| | GET users/index/{one?}/{two?}/{three?}/{four?}/{five?} | | UsersController@getIndex | | |

| | GET users | | UsersController@getIndex | | |

| | GET users/register/{one?}/{two?}/{three?}/{four?}/{five?} | | UsersController@getRegister | | |

| | POST users/create/{one?}/{two?}/{three?}/{four?}/{five?} | | UsersController@postCreate | | |

| | GET users/login/{one?}/{two?}/{three?}/{four?}/{five?} | | UsersController@getLogin | | |

| | POST users/signin/{one?}/{two?}/{three?}/{four?}/{five?} | | UsersController@postSignin | | |

| | GET users/dashboard/{one?}/{two?}/{three?}/{four?}/{five?} | | UsersController@getDashboard | | |

| | GET users/logout/{one?}/{two?}/{three?}/{four?}/{five?} | | UsersController@getLogout | | |

| | GET users/{_missing} | | UsersController@missingMethod | | |

+--------+------------------------------------------------------------+------+-------------------------------+----------------+---------------+

我试图访问localhost:8000 / users / login或任何控制器中的任何方法

出现此消息

Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException

Controller method not found.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值