jQuery ajax() POST to Slim PHP framework

拈花ヽ惹草 提交于 2019-12-03 08:31:27

Have you tried:

$app->post('/', function() use ($app) {
       // ...
       $req = $app->request();
       echo json_encode($req->post('namec'));
       //...
}

Also this page should help

As per slim v3 you can access the request object with $request->getParams()

$app->get('/', function (Request $request, Response $response){
   $data = $request->getParams()
   echo json_encode($data['namec']);
}

see documentation here https://www.slimframework.com/docs/v3/objects/request.html#route-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!