The store will not work correctly when cookies are disabled.
- Home
- Blog
- How to get base URL , media URL and link URL via object manager ?
How to get base URL , media URL and link URL via object manager ?
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $_objectManager->get('Magento\Store\Model\StoreManagerInterface');
$currentStore = $storeManager->getStore();
$baseUrl = $currentStore->getBaseUrl();
$mediaUrl = $currentStore->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
$linkUrl = $currentStore->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK);
December 6, 2021 | View: 129
Copyright © 2024 Tridhya Tech Limited, Inc. All rights reserved.