function _get_request_page_vars() { $request_uri = _request_path(); // return parts of URI split by / e.g. /properties/ID43123 return explode('/', $request_uri); }
<?php require_once './vendor/autoload.php'; Twig_Autoloader::register(); require './inc/common.inc.php'; print_r(_request_path()); print_r(_get_request_page_vars()); print_r($_GET); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="favicon.ico"> <title>TAY Lettings</title> <!-- Fonts --> <link href='http://fonts.googleapis.com/css?family=Lato:300,400,700' rel='stylesheet' type='text/css'> <!-- Bootstrap core CSS --> <link href="/dist/css/bootstrap.css" rel="stylesheet"> <!-- Bootstrap theme CSS --> <link href="/dist/css/bootstrap-theme.css" rel="stylesheet">
function request($override = array()) { static $request; if (!isset($request)) { $body = file_get_contents('php://input'); $request = array('method' => strtoupper($_SERVER['REQUEST_METHOD']), 'path' => rawurldecode('/' . ltrim(_request_path(), '/')), 'query' => $_GET, 'form' => $_POST, 'server_vars' => $_SERVER, 'headers' => _request_headers(), 'body' => false === $body ? NULL : $body); } $request = $override + $request; return $request; }