reasonableframework/system/uri.php

49 lines
902 B
PHP
Raw Normal View History

2017-12-22 18:39:21 +00:00
<?php
if(!function_exists("base_url")) {
function base_url() {
global $config;
2017-12-22 18:41:14 +00:00
2017-12-22 18:39:21 +00:00
$base_url = '';
2017-12-31 16:16:24 +00:00
if(!array_key_empty("base_url", $config)) {
2017-12-22 18:39:21 +00:00
$base_url = $config["base_url"];
}
return $base_url;
}
}
2017-12-22 18:41:14 +00:00
if(!function_exists("get_uri")) {
function get_uri() {
2017-12-31 16:16:24 +00:00
global $requests;
2017-12-22 18:41:14 +00:00
$request_uri = '';
2017-12-31 16:16:24 +00:00
if(!array_key_empty("REQUEST_URI", $_SERVER)) {
$request_uri = $requests["_URI"];
2017-12-22 18:41:14 +00:00
}
return $request_uri;
}
}
2017-12-31 17:24:39 +00:00
if(!function_exists("get_requests")) {
function get_requests() {
$requests = array(
"_ALL" => $_REQUEST,
"_POST" => $_POST,
"_GET" => $_GET,
"_URI" => !array_key_empty("REQUEST_URI", $_SERVER) ? $_SERVER["REQUEST_URI"] : ''
);
return $requests;
}
}
2018-02-09 10:57:23 +00:00
if(!function_exists("redirect_uri")) {
function redirect_uri($uri, $permanent=false) {
header('Location: ' . $uri, true, $permanent ? 301 : 302);
exit();
}
}
2017-12-31 17:24:39 +00:00
$requests = get_requests();