更正拉什维的答案: section/group/field
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$conf = $objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface')->getValue('section/group/field');
另外,如果要添加商店过滤器,例如要在商店配置级别保存时显示文本,则只需添加以下内容:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORES;
$conf = $objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface')->getValue('carriers/freeshipping/extra_info',$storeScope);
其次,批评:通过DI将其包含在您的块类的构造函数中是很不错的。这只是概念