Magento2 get admin url

Magento2 get admin URL

If want to get admin URL to Magento 2 then your can try below Solution

In order to get admin  URL ,you need to inject the  Magento_Backend ‘s helper class Magento\Backend\Helper\Data  to  __construct() function.

 

 

 

Here you will get  Magento 2 get admin url from getAdminUrl() which basically return

 

Magento_Backend module’s  getHomePageUrl() function, This function also given admin home page url.

One thought on “Magento2 get admin url

Leave a Reply

Your email address will not be published. Required fields are marked *