create('phprs\\RouterWithCache'); //var_dump($router); $router(); } catch (NotFound $e) { header($protocol . ' 404 Not Found'); $err = $e; } catch (BadRequest $e) { header($protocol . ' 400 Bad Request'); $err = $e; } catch (Forbidden $e) { header($protocol . ' 403 Forbidden'); $err = $e; } catch (\Exception $e) { header($protocol . ' 500 Internal Server Error'); $err = $e; } if ($err) { header("Content-Type: application/json; charset=UTF-8"); $estr = array( 'error' => get_class($err), 'message' => $err->getMessage(), ); echo json_encode($estr, JSON_UNESCAPED_UNICODE); } } }