2014/02/09

PHP5 JSON



<?php

 //String to JSON
 $json = json_decode('{"a":1, "b":2, "c":3}');
 print_r($json);
 echo "<br><br><br>";

 //JSON to String
 $json = json_encode($json);
 print_r($json);
?>




參考資料:
http://tw2.php.net/manual/en/function.json-decode.php
http://tw2.php.net/manual/en/function.json-encode.php