I need to get admin values to a PHP file located in Magento 2 root folder.
In Magento 1 I could do it by:
require ('./../../app/Mage.php');
How can I do this in Magento 2?
I need to get admin values to a PHP file located in Magento 2 root folder.
In Magento 1 I could do it by:
require ('./../../app/Mage.php');
How can I do this in Magento 2?
<?php
ini_set('display_errors', 1);
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
$config = $obj->create('Magento\Framework\App\Config\ScopeConfigInterface');
echo $config->getValue('path/to/config', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
exit;
You just need to replace path/to/config
with your config path