php - How does Laravel implement clean URL and redirect them to Controllers -


the title says pretty well... how laravel implement clean url , redirect them right controllers.

some frameworks cakephp use .htaccess redirect frontcontroller dispatch requests laravel doesn't use .htaccess bit confused.

laravel use concept of "routing", clean url usually defined , mapped resolve view, such controller action, anonymous functions, plain string, etc...

each request caught file located at: public/index.php (that done .htaccess file located @ same location). index.php file boostrap or illuminate laravel framework, , laravel run code. how done? routing.

the routing configuration stored in file located @ app/routes.php route might follows:

route::get('/users',            'usercontroller@showusers'); route::get('/users/create',     'usercontroller@createuser'); route::post('/users/create',    'usercontroller@processcreateuser'); route::get('/users/edit/{id}',  'usercontroller@createuser'); route::post('/users/edit/{id}', 'usercontroller@processcreateuser'); 

more information routing can read @ the documentation. recommend read docs since routing quite powerful in laravel.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -