如何使用php在slim框架中使用request-> getBody()获取表单数据?

I am trying the fetch the form data. I dont know where the mistake is.

<html>
<head>
<title>Student</title>
</head>
<body>
<form name="std" action="insert/std_insert" method="POST">
Student id:<input type="text" name="std_id" id="std_id"><br>
Student name:<input type="text" name="std_name" id="std_name"><br>
<input type="submit" name="submit" value="submit">
</body>
</html>

This is the code for fetching

<?php
error_reporting(0);
$app = new \Slim\Slim();
$body = $app->request->getBody();
echo json_encode($body);
?>

The request object is not full-filled until the app has been run. IE $app->run(); You are actually not using Slim correctly. docs.slimframework.com

Based on geggleto´s answer:

if( $request->isPost() ){
  $postdata_as_array = $request->getParsedBody();
}