I’m passing a JSON encoded data from my flash file to php i traced the data output using firebug and i see it’s being passed along to php but when i try to return the values back to flash through php i get an empty string can some one expalin why php is behaving like that? here is the code
<?php
$data = urldecode(utf8_decode(stripslashes($_REQUEST['data'])));
$decoded_result = json_decode($data);
print_r($decoded_result);
echo output.'='.$decoded_result;
?>
Did you miss a
$in theoutputvariable name?Come to think of it, where is the
$outputvariable name? is there even one?Also, you’re invoking
json_decode, which decodes JSON into native PHP objects, which don’t have an implicit string representation, which will look weird when you do coerce it to a string, I think you meant to just output the JSON decoded from thedata$_REQUESThash, there is no use in returning a PHP object to the client.Maybe you meant to do this: