我是laravel的新手,刚试过一些例子。这就是:路由和控制器
laravel-master\app\controllers\account.php -
class AccountController extends BaseController
{
public function action_index()
{
echo "This is the profile page.";
}
public function action_login()
{
echo "This is the login form.";
}
public function action_logout()
{
echo "This is the logout action.";
}
}
然后我说的一行 - laravel-master\app\routes.php
Route::controller('account');
所以,当我会去的主网页
- 的myproject /帐号/登录它应该显示 “这是登录表单。” 。
但其示出
Missing argument 2 for Illuminate\Routing\Router::controller(), called in C:\Program Files\Zend\Apache2\htdocs\laravel-master\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 177 and defined
。
不知道是什么问题。我在哪里错了吗?
是的,它是工作后,我从account.php名称更改为AccountController.php。但我didnot不明白的东西。我试图myproject /帐户/登录其显示结果页。但我尝试了我的项目/帐户/登录。它显示“Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException。 “然后我再次将functon名称改为get_index(),get_login,get_logout()。当我去我的项目/帐户/登录时,它显示result.So为什么它显示错误时,我将信件更改为资本getIndex,getLogin,getLogout,get_Index,get_Login,get_logout? – user1638279
还有/ account/Login,/ account/Index,/ account/Logout不起作用,但/ account/login,/ account/logout,/ account/index working 。 – user1638279
使用控制器路由时Laravel 4允许您使用get_login或getLogin,它们都可以通过帐户/登录访问,但不能*帐户/登录,帐户/登录等。换句话说,区分大小写 – Makita