简体   繁体   中英

Laravel 4 route NotFoundHttpException

I'm new to programming. I've been using codeigniter, and Laravel seemed a classy framework to learn. I have this routes:

Route::get('slider', 'AdminController@getSlider');
Route::get('/', 'AdminController@getSlider');

and my controller:

class AdminController extends BaseController {

    public function getSlider(){
        return View::make('list', array('section' => 'slider_home'));
    }

}

"public/" works great. "public/slider" spits NotFoundHttpException.

If there is some data that i should add please tell me.

Thanks, and excuse my english.

UPDATE:

I got it wrong. The correct URL was "public/index.php/slider". Now I need to modify the .htacces to change that.

Try this Route :

Route::controller('','AdminController');

Controller :

class AdminController extends BaseController {

public function getIndex(){
    return View::make('list', array('section' => 'slider_home'));
 }
public function getSlider(){
    return View::make('list', array('section' => 'slider_home'));
 }
}

ok you can use public/ and public/slider

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