Browse Source

json body post support

master
filesite 2 years ago
parent
commit
2091161730
  1. 10
      controller/Controller.php

10
controller/Controller.php

@ -10,6 +10,16 @@ Class Controller {
if (!empty(FSC::$app['config']['default_layout'])) { if (!empty(FSC::$app['config']['default_layout'])) {
$this->layout = FSC::$app['config']['default_layout']; $this->layout = FSC::$app['config']['default_layout'];
} }
//json body auto serialization to $_POST
try {
$json = file_get_contents('php://input');
$jsonData = json_decode($json, true);
if (!empty($jsonData)) {
$_POST = array_merge($_POST, $jsonData);
}
}catch(Exception $e) {}
} }
function __destruct() { function __destruct() {

Loading…
Cancel
Save