Esempio n. 1
0
 public static function parse()
 {
     $head = getallheaders();
     $body = $GLOBALS['config']['body'];
     if ($body == "") {
         Bone::error(400, ['Invalid Request Body']);
     }
     switch (true) {
         case strpos($head['Content-Type'], 'application/json') !== false:
             $input = (array) json_decode($body);
             break;
         case strpos($head['Content-Type'], 'application/x-www-form-urlencoded') !== false:
             parse_str($body, $input);
             break;
         default:
             parse_str($body, $input);
             break;
     }
     return $input;
 }
Esempio n. 2
0
<?php

require_once "lib/Bone.php";
require_once "vendor/autoload.php";
//run configuration
Bone::config(include 'config/config.php');
Bone::route(include 'config/route.php');
//
require_once "config/setup.php";
// Bone::error(404, "This not found");
Bone::run();
// $user = new userController();
// $user->index();