2015-01-21 113 views

回答

9

尝试以下操作:

$value = "100"; 
Mage::getModel('core/config')->saveConfig('my/path/whatever', $value); 

OR

$resource = $this->getResourceModel(); 
$resource->saveConfig(rtrim('my/path/whatever', '/'), 1, 'default', 0); 
+0

是的,就是这样,谢谢! – user4095519 2015-01-21 09:27:46

+0

这是否适用于任何配置设置?我在magento.exchange中有类似的问题:http://magento.stackexchange.com/questions/105634/how-to-export-import-features-settings-in-magento – Jurik 2016-03-14 15:28:16

0

帝国解决方案是正确的,但千万记得之后清理缓存。所以使用类似

$value = "100"; 
Mage::getModel('core/config')->saveConfig('my/path/whatever', $value); 
Mage::getModel('core/config')->cleanCache(); 
相关问题