2013-03-31 38 views
1

一个简单的REST GET调用如何在slim框架中处理URL中的参数?

http://localhost/root/student/11 

可以通过

$data->get('/student/:id', 'getStudent'); 

来处理,但是我有一个要发送的参量数据一样,因为它解决了

http://localhost/root/student?id=11 

如何我的其他问题我可以在SLim框架中处理这些数据吗?

回答

2

苗条文档:Request Variables

你举的例子:

$app->get('/root/student', function() use ($app) { 
    $id = $app->request()->get("id"); 
    //$id is '11' now 
});