• 17-12-2014, 18:33:06
    #1
    Merhaba

    Aşağıdaki json kodunun;

    {
    	"test.com": 
    	{ 
    		"IP": "10.133.217.111", 
    		"IP6": "", 
    		"U_DISK": "0", 
    		"U_BANDWIDTH": "0", 
    		"TPL": "hosting", 
    		"ALIAS": "www.test.com", 
    		"STATS": "", 
    		"STATS_USER": "", 
    		"SSL": "no", 
    		"SSL_HOME": "same", 
    		"FTP_USER": "", 
    		"FTP_PATH": "", 
    		"PROXY": "default", 
    		"PROXY_EXT": "jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm", 
    		"SUSPENDED": "no", 
    		"TIME": "11:29:26", 
    		"DATE": "2014-12-17" 
    	}, 
    	"test2.com": 
    	{ 
    		"IP": "10.133.217.111", 
    		"IP6": "", 
    		"U_DISK": "0", 
    		"U_BANDWIDTH": "0", 
    		"TPL": "hosting", 
    		"ALIAS": "www.test2.com", 
    		"STATS": "", 
    		"STATS_USER": "",
    		"SSL": "no", 
    		"SSL_HOME": "same", 
    		"FTP_USER": "", 
    		"FTP_PATH": "", 
    		"PROXY": "default", 
    		"PROXY_EXT": "jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm", 
    		"SUSPENDED": "no", 
    		"TIME": "11:29:32", 
    		"DATE": "2014-12-17" 
    	} 
    }
    Aşağıdaki gibi for dönüsü ile nasıl yazdırabiliriz?

    site adresi - disk kullanımı(U_DISK)
    test.com - 0
    test2.com - 0


    Şimdiden teşekkürler
  • 17-12-2014, 18:40:40
    #2
    $data = json_decode($json_verisi);
    foreach ($data as $key => $value){
    	echo $key." - ".$value->U_DISK."<br>";
    }
    Çıktısı
  • 17-12-2014, 18:47:42
    #3
    PsdBul adlı üyeden alıntı: mesajı görüntüle
    $data = json_decode($json_verisi);
    foreach ($data as $key => $value){
    	echo $key." - ".$value->U_DISK."<br>";
    }
    Çıktısı
    Desteğin için teşekkür ederim