2017-04-08 58 views
1

即时通讯新的使用苗条框架和我试图让一个get。它不返回任何东西,它返回一个代码200Rest-我的get方法不返回任何东西

$app->get('/noticias',function()use ($db,$app){ 
    try{ 
     $consulta = $db->prepare("select * from noticias"); 
     $consulta->execute(); 

     $resultados = $consulta->fetchAll(PDO::FETCH_ASSOC); 
     echo json_encode($resultados); 
    }catch (Exception $ex){ 
     echo 'We cant show the news'; 
    } 
}); 

When I make a get this is the result

你知道苗条框架的一些教程?

感谢

+0

'var_dump($ resultados)'并参阅 – hassan

+0

有关slim的教程,请参阅此[Slim Framework for beginners](http://stackoverflow.com/a/15089720/2151290) –

回答