<?php
$ jsonData = array(
“comments”=>“Fresh food“,
”container“=> false,
”cookedTime“=> 2,
”description“=>”biryani“,
”refridgeration“=> true,
”服务“ => 2,
“veg”=> true
);
json_encode($ jsonData);
header(“Location:Post.php?json = $ jsonData”);
?> \ n code> pre>
这是我的php页面,其中包含json对象。 我将这个json对象传递到另一个页面Post.php。 p>
<?php
$ jsonData = $ _GET ['json'];
json_decode($ jsonData, TRUE);
echo var_dump($ jsonData);
?>
code> pre>
当我进行转储时,结果是C:\ wamp \ www \ Hack \ Post.php:16:字符串'Array'(长度= 5)。
它正在打印“Array”而不是json对象。 我该怎么办? p>
div>
<?php
$jsonData = array(
"comments" => "Fresh food",
"container" => false,
"cookedTime" => 2,
"description" => "biryani",
"refridgeration" => true,
"serves" => 2,
"veg" => true
);
json_encode($jsonData);
header("Location:Post.php?json=$jsonData");
?>
This is my php page which contains json object. I am passing this json object into another page Post.php.
<?php
$jsonData = $_GET['json'];
json_decode($jsonData, TRUE);
echo var_dump($jsonData);
?>
when I did a dump the result is C:\wamp\www\Hack\Post.php:16:string 'Array' (length=5). It is printing "Array" instead of the json object. What do I do?