Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
解密/使用存储为在magento中加密的config_backend_的配置值_Magento - Fatal编程技术网

解密/使用存储为在magento中加密的config_backend_的配置值

解密/使用存储为在magento中加密的config_backend_的配置值,magento,Magento,我在做一个运输模块。 在system.xml中,我将一些字段设置为backend\u加密。以下是节点: <client_id translate="label"> <label>Client ID</label> <frontend_type>obscure</frontend_type> <backend_model>adminhtml/system_config_backend_encryp

我在做一个运输模块。 在
system.xml
中,我将一些字段设置为
backend\u加密
。以下是节点:

<client_id translate="label">
     <label>Client ID</label>
     <frontend_type>obscure</frontend_type>
     <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
     <sort_order>10</sort_order>
     <show_in_default>1</show_in_default>
     <show_in_website>1</show_in_website>
     <show_in_store>0</show_in_store>
</client_id>

客户端ID
模糊的
adminhtml/system\u config\u backend\u加密
10
1.
1.
0
我需要使用cURL将该值传递给shipping API,但是,当我尝试使用
$this->getConfigData('client_id')检索它时,它是加密的

我在查看其他模块时,发现存储的值是相同的,但不知怎的,它们设法获得了正确的值


知道如何获取它吗?

只需使用
Mage::helper('core')->解密($this->getConfigData('client_id'))

以便使用
$this->getConfigData('client_id')
在不手动解密的情况下,您需要通过添加
来更新config.xml,请参见下面的示例

在config.xml中

...
    <default>
        <carriers>
            <magepal>
                ......
                <client_id backend_model="adminhtml/system_config_backend_encrypted" />
            </magepal>
        </carriers>
    </default>
</config>
。。。
......

有效,谢谢。但为什么我没有看到任何其他模块上的解密参考?如果你能帮忙的话,我用错了,不该用的地方?你做的一切都是对的。如果你在Magento代码中搜索“decrypt”,你会得到大量的参考资料。添加这些参考资料将透明地解密配置值,我认为10种情况中有9种是真正需要的。虽然Tim的解决方案可行,但我认为这是一个更正确的答案。^^虽然公认的答案“可行”,但这确实看起来更“正确”。