template.php 584 Bytes
<?php
header('Content-Type: application/json'); //pour que le navigateur l'affiche dans le format json
include('bdd.php');

function reponse_json($data){
    $array['result']=$data;

    echo json_encode($data);

}













// echo json_encode($aliments);

// $retour = array(); 
// $retour["aliments"]= array();
// $retour["aliments"][0]["id"] = 1; 
// $retour["aliments"][0]["name"] = "Pomme";
// $retour["aliments"][0]["type"] = "Fruit";
// $retour["aliments"][1]["id"] = 2; 
// $retour["aliments"][1]["name"] = "Poire";
// $retour["aliments"][1]["type"] = "Fruit";
// `LOGIN`