dimanche 7 janvier 2018

Web service for web/android

I have that web service

$app->get('/students', function(){
require_once('db/config.php');
foreach ($db->students()
             ->order("name")
         as $row){
    $data[]=$row;
}


echo  json_encode($data, JSON_UNESCAPED_UNICODE); //for android

$loader = new Twig_Loader_Filesystem('views/students/');

$twig = new Twig_Environment($loader, array());

$template = $twig->loadTemplate('singup.php');

echo $template->render(array('data' => $data)); //for web
});

Someone knows how can i call the correct echo for android and for web, because this way the webservice do the too echo.

Aucun commentaire:

Enregistrer un commentaire