【问题标题】:slim PHP Get parametersslim PHP 获取参数
【发布时间】:2017-04-18 16:58:49
【问题描述】:

使用 Slim 2 框架从 URI 中获取属性

http://localhost:8080/serverEndModule1/v1/varifyid=OQ==&code=1e212ffc375e52a9c6e7debe8adcc17 使用以下代码:

$app->get('/varify', function () use ($app) {
$id = $app->request->get('id');
$paramValue2 = $app->request->get('code');
$db = new DbOperation();
$response = array();
$db->userVarify($id, $code); // send to database 

帮我实现以下 $app->get route 。

【问题讨论】:

  • 请提供一个具体问题以及您实施的内容以及与您的预期相比它如何不起作用的信息。

标签: web-services rest slim router getparameter


【解决方案1】:

谢谢,现在可以用了

$app->get('/varify', function() 使用 ($app){

 $req = $app->request();
$id = $req->get('id');   // 
$code = $req->get('code');


 $db = new DbOperation();
$response = array();

$res= $db->userVarify($id, $code); }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-30
    • 1970-01-01
    • 1970-01-01
    • 2015-11-16
    • 2021-11-25
    • 1970-01-01
    相关资源
    最近更新 更多