在PHP中解码文本不解码

时间:2015-07-06 10:35:31

标签: php html mysql urlencode urldecode

因此。我有三个来自WYSIWYG编辑器的大量文本,我需要存储在DB(MySQL)中。为此,我使用PHP函数In [131]: df.groupby('A').apply(lambda x: list(np.repeat(x['B'].values, x['quantity']))) Out[131]: A 1 [foo, baz, baz, bar, bar, faz] 2 [foo, foo, bar] 3 [foo, foo, foo] dtype: object 将它们放在一个数组中并rawurlencode()数组,然后插入到DB中。但问题是我需要serialize()

首先我rawurldecode()然后文本解码正常,但图片标记解码如下:

unserialize()

有多个这些 - &gt; `<img alt="\"\"" src="\"/ckfinder/userfiles/images/facebook.PNG\"" style="\"float:right;" height:200px; width:198px\">` 我不需要,实际上它们不会出现在未编码的代码中。 \"没有得到帮助。

也许我做错了什么,有更好的方法如何在序列化数组中存储长文本?

1 个答案:

答案 0 :(得分:0)

使用PHP中默认提供的stripcslashes()函数。 它将删除作为转义字符添加的反斜杠。 Example