简体   繁体   中英

laravel controller doesn't exist though it exists

This is the route

Route::get('contact', 'Pages@contact');

The is the controller:

<?php
class PagesController extends BaseController {


  public function contact()
  {
    return View::make('hello');
  }

}

This is the error message

500 Internet error
ReflectionException
Class Pages does not exist

I am using laravel 4.2

Your controller name in the route given below:

Route::get('contact', 'Pages@contact');

Should be

Route::get('contact', 'PagesController@contact');

Because the controller name is PagesController not Pages . So Class Pages does not exist error is rising and it's logical because the Pages class doesn't exist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM