v2.5.2
Giriş yap

php json yazdırma

Anonim
534 defa görüntülendi ve 1 kişi tarafından değerlendirildi

böyle bir json datası var elimde ben servis1 , servis2 yazan yeri yazdırmak istiyorum ama başaramadım

{
"servis1": {
"Category": "activation",
"Qty": 2000,
"Price": 14.83
},
"servis2": {
"Category": "activation",
"Qty": 11413,
"Price": 19
}

bu benim php kodum

<?php
session_start();
include"/vendor/autoload.php";
include"/baglan.php";

//$insert =  $DB->query("INSERT INTO sc_ulke(ulke_isim) VALUES(?)", array($_POST["ulke_isim"]));
 
$ulke =  $DB->query("SELECT * FROM sc_ulke");

foreach ($ulke as $value) {

 
   $url = file_get_contents("xxxxx".trim($value["ulke_isim"])."/xxxx");
   $json = json_decode($url,true);
 
   
 print_r($json);
 
 
}
 
 ?>
makifgokce
953 gün önce

json verinin en sonundaki süslü parantez eksik bu yüzden sonuç alamıyorsun.