[英]How to process paramerters in URL in slim framework?
A simple REST GET call 一个简单的REST GET调用
http://localhost/root/student/11
can be handled via 可以通过处理
$data->get('/student/:id', 'getStudent');
I however have a want to send parametric data like because it solves my other problem in 但是,我想发送像这样的参数数据,因为它解决了我的其他问题
http://localhost/root/student?id=11
How can I process this data in SLim framework ? 如何在SLim框架中处理这些数据?
Slim docs: Request Variables . 苗条文档: 请求变量 。
Your example: 你的例子:
$app->get('/root/student', function() use ($app) {
$id = $app->request()->get("id");
//$id is '11' now
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.