I want echo value json_encode by json_decode, how is it?
Following php code is my try that not work:
$json = '[{"dg_j":"1390\/02\/05","dg_sh":"2011\/4\/25"}]';
$obj = json_decode($json);
echo $obj->{'dg_j'};
echo '<br>';
echo $obj->{'dg_sh'};
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you’ve got is actually an array that contains a single object. You’d want
Doing a
var_dump($obj)will show you what the JSON actually turned into.