getstoreconfig和getstoreconfigflag之间的差异是什么?

时间:2017-01-03 06:26:08

标签: configuration config magento-1.9 magento-1.8

在magento 1.9 getstoreconfig()和getstoreconfigflag()方法之间的差异是什么?

1 个答案:

答案 0 :(得分:3)

方法看起来像这样:

    public static function getStoreConfig($path, $store = null)
    {
        return self::app()->getStore($store)->getConfig($path);
    }

    public static function getStoreConfigFlag($path, $store = null)
    {
        $flag = strtolower(self::getStoreConfig($path, $store));
        if (!empty($flag) && 'false' !== $flag) {
            return true;
        } else {
            return false;
        }
    }

唯一的区别是 getStoreConfig()将返回确切的值,而 getStoreConfigFlag()返回布尔值true或false。

两种方法都将我们发送给Mage_Core_Model_Store :: getConfig()