休息 - 我的 get 方法没有 return 任何东西
Rest- My get method doesn't return anything
我是使用 slim 框架的新手,正在尝试获取。它 return 什么都没有,它 return 是一个代码 200。
$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
你知道slim框架的一些教程吗??
谢谢
我不清楚您使用的是 Slim 版本 2 还是版本 3。您应该使用版本 3。
您应该完成的 documentation has the First Application Walkthrough 教程。
我是使用 slim 框架的新手,正在尝试获取。它 return 什么都没有,它 return 是一个代码 200。
$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
你知道slim框架的一些教程吗??
谢谢
我不清楚您使用的是 Slim 版本 2 还是版本 3。您应该使用版本 3。
您应该完成的 documentation has the First Application Walkthrough 教程。