cancel
Showing results for 
Search instead for 
Did you mean: 

What does really use of controller in magento 2

What does really use of controller in magento 2

Hi Folks,

 

Can you share your ideas on

 

What does really use of controller in magento 2.

 

Thanks

1 REPLY 1

Re: What does really use of controller in magento 2

Hi @magento_sage1

 

Well AKAIK - in Magento 2 controller is mainly used for routing purpose - meaning to route the actual path and call the specific methods !

 

Controllers are responsible for processing all requests made via a url. If you hit the url  yourwebsitedomain.com/index.php/mycustom/test - so in the controllers/mycustom/test.php and inside of that the viewAction() method called

 

Refer this link for the same - https://devdocs.magento.com/guides/v2.2/extension-dev-guide/routing.html

 

Also refer this - https://stackoverflow.com/questions/14283920/magento-model-vs-block-vs-controller-etc

if issue solved,Click Kudos & Accept as Solution