0

Hello I am using JSON.stringify for an array of arrays, and it returns this:

'[
  ["<span pt=\"7.5\" idfont=\"Humnst777 Cn BT-Bold\">Javelin</span>","0","0"],
  ["<span idfont=\"Humnst777 Cn BT-Bold\">Javelin&co</span>","0","0"]
 ]';

It is correct but i have to use encodeURIComponent (& present) to post this value with js. The problem is that when I get this data in POST from php with $boxes=json_decode($_POST['data']) it seems to remove slashes eg. pt=\"7.5\" -> pt="7.5" destroying the json object giving this result:

'[
["<span pt="7.5" idfont="Humnst777 Cn BT-Bold" >Javelin</span>","0","0"]
["<span pt="7.5" idfont="Humnst777 Cn BT-Bold" >Javelin&</span>","0","0"]

 ]';

Does any one how to avoid this problem? thanks

4

2 に答える 2

0

magic_quotes を有効にしていませんか? http://www.php.net/manual/en/security.magicquotes.php

于 2010-10-06T08:53:12.893 に答える
0

代わりに rawurlencode と rawurldecode を試してください。詳細については、これを参照してください

于 2010-10-06T08:59:44.423 に答える