• 04-02-2023, 13:20:40
    #1
    Elimde bir json verisi var. Bunu nasıl yazdırabilirim?
    [["Besin Deu011feri","100 Gramda","Gu00fcnlu00fck Deu011fer*"],["Kalori","564 kcal","% 27.2"],["Karbonhidrat","24 g","% 7.8"],["Lif","15 g","% 63.3"],["Protein","11 g","% 22.4"],["Yau011f","44 g","% 67.1"],["Doymuu015f Yau011f","27 g",""],["u015eeker","18 g","% 60.0"]]
  • 04-02-2023, 13:24:14
    #2
    birden fazla veri var ise foreach ile tek veri var ise $data['Kalori']; gibi tek tek yazdirabilirsin, ama keylerde bi farklilik var gibi
  • 04-02-2023, 13:30:36
    #3
    print_r()
  • 04-02-2023, 13:33:01
    #4
    Developer
    <!DOCTYPE html>
    <html>
    <head>
    <style>
    table{font-family: arial, sans-serif;border-collapse: collapse;width: 100%;}
    td, th {border: 1px solid #dddddd;text-align: left;padding: 8px;}
    tr:nth-child(even) {background-color: #dddddd;}
    </style>
    </head>
    <body>
    <?php
    $file = json_decode(file_get_contents('test.json'));
    echo '<table>';
    foreach($file as $x){
        echo '<tr>';
        foreach($x as $xx){
            echo '<td>'.$xx.'</td>';
        }
        echo '</tr>';
    }
    echo '</table>'
    ?>
    </body>
    </html>