1

一个简单的 REST GET 调用

http://localhost/root/student/11

可以通过

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

但是,我想发送参数数据,因为它解决了我的其他问题

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

如何在 SLim 框架中处理这些数据?

4

1 回答 1

2

Slim 文档:请求变量

你的例子:

$app->get('/root/student', function() use ($app) {
    $id = $app->request()->get("id");
    //$id is '11' now
});
于 2013-04-03T08:04:49.820 回答