Reputation: 317
I'm working with slim framework:
This is my code:
$app->post($sPathApi.$sVersion.'subirarchivo', function () use ($app) {
session_cache_limiter(false);
session_start();
if(isset($_SESSION['admin'])){
require "controller/controllerExcel.php";
$request = $app->request();
$body = $request->getBody();
print_r($request);
//print_r($body->env['slim.request.form_hash']);
exit();
$aInput = json_decode($body);
$aGuardar = new ControllerExcel();
header('Content-Type: application/json');
echo json_encode($aGuardar->setDataExcel());
exit();
}
});
I use print_r($request);
And I print this:
How can I get the value of ['request']
?. In the image is marked with red.
Sorry by my english.
Upvotes: 1
Views: 337
Reputation: 20286
You should use
echo $this->env['slim.request.form_hash']
You can also access env by
echo $app['environment']['slim.request.form_hash'];
Also check
http://docs.slimframework.com/environment/overview/#environment-variables
Upvotes: 1