You may need to retrieve a value from Magento 2′s core_config_data table. This table typically stores configuration settings entered in the admin area. Use the following code to read the required value:
|
1 2 3 4 5 6 7 8 9 |
public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, ... ) { $this->scopeConfig = $scopeConfig; } // Example: web/secure/base_url; any other path can be used $value = $this->scopeConfig->getValue('web/secure/base_url', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); echo $value; |
Loading a configuration value from the core_config_data table
Need help implementing this solution, or still looking for a fix to your Magento problem? Get in touch and I will be happy to help with your project.