<?php
- $array_1 = array(); //һάÊý×é
- $array_2 = array(); //¶þάÊý×é
- $array_1['username'] = "Aseoe";
- $array_1['website'] = "http://www.aseoe.com/";
- $array_2['member']['ancto.net']['username'] = "ancto";
- $array_2['member']['ancto.net']['website'] = "http://www.ancto.net/";
- $array_2['member']['aseoe.com']['username'] = "aseoe";
- $array_2['member']['aseoe.com']['website'] = "http://www.aseoe.com/";
- //print_r($array_2);
- $jsonObj_1 = json_encode($array_1); //һάÊý×éת»»³ÉjsonÊý¾Ý¸ñʽ
- //echo $jsonObj_1;
- $jsonObj_2 = json_encode($array_2); //¶àάÊý×éת»»³ÉjsonÊý¾Ý¸ñʽ
- //echo $jsonObj_2;
- class aseoe{
- public $puname = "public name";
- protected $poname = "protected name";
- private $prname = "private name";
- public function getName(){
- return $this->name;
- }
- }
- $aseoeObj = new aseoe();
- $json_aseoe =json_encode($aseoeObj); //¶ÔÏóת»»³ÉjsonÊý¾Ý¸ñʽ
- //echo $json_aseoe; //¶ÔÏóת»»ÎªjsonÊý¾Ýʱ£¬Ö»×ª»»¹«ÓбäÁ¿£¬Ë½ÓбäÁ¿²»×ª»»
- //print_r($aseoeObj);
- $jsonStr = '{"key":"value","key1":"value2"}';
- $json2Array = json_decode($jsonStr,true); //ûÉèµÚ2¸ö²ÎÊýʱ£¬Ä¬ÈÏÊǶÔÏóÀàÐÍ
- print_r($json2Array);
$jsonStr='{"key":"value","key1":"value1"}';
json_decode($jsonStr);//ת»»Ö®ºóÊǶÔÏóÀàÐÍ
json_decode($jsonStr,true);//ת»»Ö®ºóÊÇÊý×é
±¾Õ¾»¶ÓÈκÎÐÎʽµÄתÔØ£¬µ«ÇëÎñ±Ø×¢Ã÷³ö´¦£¬×ðÖØËûÈËÀͶ¯³É¹û
תÔØÇë×¢Ã÷£º ÎÄÕÂתÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-12-467-1.html
תÔØÇë×¢Ã÷£º ÎÄÕÂתÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-12-467-1.html