我是通過一個JSON編碼的URL解碼到PHP通過我的Flash程序產生無法JSON
下面是當我在php結束
做一個跟蹤myObject=%5B%7B%22fullname%22%3A%22jon%20jay%20junior%22%2C%22role%22%3A%22ADMIN%22%2C%22username%22%3A%22jjj%22%7D%5D
的是我所得到
$jsonString = urldecode($_POST['myObject']);
$jsonString = str_replace("\\", "", $jsonString);
$data = JSON_decode($jsonString);
print_r($data);
但我沒有得到什麼我在這裏做錯了什麼?
碼閃光燈
var people:Array = new Array();
var person:Object = new Object();
var url:String = "http://localhost/ping.php";
var request:URLRequest = new URLRequest(url);
var requestVars:URLVariables = new URLVariables();
var loader:URLLoader = new URLLoader();
person.fullname = "jon jay junior";
person.username = "jjj";
person.role = "ADMIN";
people.push(person);
request.method = URLRequestMethod.POST;
requestVars.myObject = JSON.encode(people);
request.data = requestVars;
loader.load(request);
trace(request.data);
幫助!任何人?
做當您通過閃存發送數據時,您是否正確編碼? 如果您刪除了解碼行,會發生什麼情況? – Breezer 2010-12-01 17:51:28
我可以看到生成JSON字符串的代碼以及它的編碼/發送位置嗎? – www0z0k 2010-12-01 17:56:11
發佈了上面的代碼 – hitek 2010-12-01 18:00:34