Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Methods 什么是;方法[show]不存在“;什么意思?_Methods_Laravel_Laravel 4 - Fatal编程技术网

Methods 什么是;方法[show]不存在“;什么意思?

Methods 什么是;方法[show]不存在“;什么意思?,methods,laravel,laravel-4,Methods,Laravel,Laravel 4,我对Laravel4还不熟悉,我试图弄明白为什么我会得到一个错误,说方法[show]不存在 我没有一个名为“show”的方法,只能想象这是一个内部的Laravel方法,但我不知道如何影响它,也不知道是什么做的。任何关于这方面的想法或帮助都将不胜感激,因为我已经被困在这个问题上两天了,无法找出我做错了什么 视图: <li><a href="{{ URL::route('account-sign-in') }}">Sign in</a></li> 会

我对Laravel4还不熟悉,我试图弄明白为什么我会得到一个错误,说方法[show]不存在

我没有一个名为“show”的方法,只能想象这是一个内部的Laravel方法,但我不知道如何影响它,也不知道是什么做的。任何关于这方面的想法或帮助都将不胜感激,因为我已经被困在这个问题上两天了,无法找出我做错了什么

视图:

<li><a href="{{ URL::route('account-sign-in') }}">Sign in</a></li>
会计控制员:

class AccountController extends BaseController { 
  public function getSignIn(){ 
    return View::make('user.signIn'); 
  } 

  public function postSignIn(){ 
    $validator = Validator::make(Input::all(), array( 'email' => 'required|email', 'password' => 'required' ) ); 
    if($validator->fails()){ /*Redirect to the sign in page*/ 
      return Redirect::route('account-sign-in') ->withErrors($validator) ->withInput();
    } 
    else { /*Attempt user sign in*/ 
      $remember = (Input::has('remember')) ? true : false;
      $auth = Auth::attempt(array( 'email' => Input::get('email'), 'password' => Input::get('password'), 'active' => 1 ), $remember); 
      if($auth){ 
        /*Redirect to the intended page*/ return Redirect::intended('/'); 
      } 
      else {
        return Redirect::route('account-sign-in')->with('global', 'Email/password wrong, or account not activated.'); 
      } 
    } 
    return Redirect::route('account-sign-in') ->with('global', 'There was a problem signing you in.'); 
  } 
}
“方法[显示]不存在”是什么意思

无论如何,问题中提供的代码并没有显示有关show()方法的任何内容。根据您的评论,您没有扩展
BaseController
,但是您的所有控制器都应该扩展BaseController,
BaseController
应该扩展
Controller
,因此这就是
BaseController
的外观(默认情况下):

您的控制器应该像这样扩展它:

class AccountController extends BaseController {

    // Define all of your methods
    // including show() if you are using it

}

听起来你只是在AccountController的第一行有一个输入错误

它可能会说
类AccountController扩展BasesController{


BasesController
应该是
BaseController

我遇到了这个问题。我以前在routes.php文件中列出了一个导致冲突的资源(现在已弃用)

Route::resource('scheduler', 'SchedulerController');
Route::get('scheduler/notices', 'SchedulerController@notices');

向我们展示xdebug stacktrace。不确定这是什么。这是最后5个事件-[2014-03-16 20:44:07]production.ERROR:exception“Symfony\Component\Debug\exception\FatalErrorException”,在C:\xampp\htdocs\local\tbf3\app\controllers\AccountController.php:6堆栈跟踪:#0[内部函数]:illumb\Exception\Handler->handleShutdown()#1{main}[][2014-03-16 20:45:01]production.ERROR:Exception'Symfony\Component\Debug\Exception\FatalErrorException',在C:\xampp\htdocs\local\tbf3\app\controllers\AccountController.php:3I注意到它说找不到“类BasesController”。我没有任何名为BasesController的控制器,也没有任何引用它的控制器。有什么想法吗?下面是错误消息出现的调试消息:19。BadMethodCallException…\vendor\laravel\framework\src\light\Routing\Controller.php266 18。照亮\路由\控制器\呼叫0 17。AccountController显示0 16。调用\u user\u func\u array…\vendor\laravel\framework\src\illumb\Routing\Controller.php231 15。Illumb\Routing\Controller callAction…\vendor\laravel\framework\src\Illumb\Routing\ControllerDispatcher.php93 14。Illumb\Routing\ControllerDispatcher调用…\vendor\laravel\framework\src\Illumb\Routing\ControllerDispatcher。php62@gv0029您需要包括整个AccountController,或者至少包括类声明行,以及任何其他相关的代码段感谢您的输入,不幸的是,情况并非如此,正如你所指出的那样,我确实设置了控制器。也许你应该解释一下情况是什么,我从你的问题和评论中得到的所有信息:-)通常拉威尔非常直截了当:你做一个视图,你做一条路线,你做一个控制器。上面的路由、控制器和视图对我来说似乎都是有意义的(我只粘贴了每个视图中与此视图相关的部分),但有些东西不起作用。因此,我的下一个想法是,这里发生的事情比简单的视图->路由->控制器动态更多。我想知道有没有人有什么想法。当然,这可能是因为我在上面写的东西中有一个明显的错误,只是没有看到而已。但我们欢迎您的想法和意见!我也这么想,但已经检查过:@gv0029尝试在项目根目录中运行命令
php artisan dump autoload
。自动加载的类(如控制器/模型)如果在不转储自动加载的情况下更改其类名,有时会导致错误。
class AccountController extends BaseController {

    // Define all of your methods
    // including show() if you are using it

}
Route::resource('scheduler', 'SchedulerController');
Route::get('scheduler/notices', 'SchedulerController@notices');