Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.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
Php 保存时在magento中编码产品数据_Php_Magento_Save_Product - Fatal编程技术网

Php 保存时在magento中编码产品数据

Php 保存时在magento中编码产品数据,php,magento,save,product,Php,Magento,Save,Product,我们有一些magento产品的文本字段,其值如下 <iframe width='465' height='548' frameborder='0' src='http://connect.garmin.com:80/activity/embed/263316017'></iframe> 所以,我们希望在保存产品时对该值进行编码,否则该数据不会被发布。 请回复对帖子数据进行编码的答案。您可以对帖子数据进行编码,但对帖子数据进行加密和编码可能更节省时间。下面是一个小代码示例

我们有一些magento产品的文本字段,其值如下

<iframe width='465' height='548' frameborder='0' src='http://connect.garmin.com:80/activity/embed/263316017'></iframe>
所以,我们希望在保存产品时对该值进行编码,否则该数据不会被发布。
请回复对帖子数据进行编码的答案。

您可以对帖子数据进行编码,但对帖子数据进行加密和编码可能更节省时间。下面是一个小代码示例


然后可以使用Mage::helper'core'->解密;解密保存的数据。

为什么不使用base64_编码和base64_解码?我想你的问题是,你没有首先提交表单数据。通常在JavaScript端使用encodeURIComponent对这些内容进行正确编码。如果您使用的是WYSIWYG编辑器,这可能有一定的相关性:
$encryptedData = Mage::helper('core')->encrypt('this is some data');
$encodedUrl = Mage::getUrl('module/controller/action', 
                               array('parameter'=> $encryptedData);