Skip to content

Instantly share code, notes, and snippets.

@mfyance
Created July 24, 2018 23:30
Show Gist options
  • Save mfyance/b76515fecc063865d23bae5534c40d28 to your computer and use it in GitHub Desktop.
Save mfyance/b76515fecc063865d23bae5534c40d28 to your computer and use it in GitHub Desktop.
Configurar Path General
<?php
$port = ($_SERVER['SERVER_PORT'] != "" ) ? ":" : "";
$server2 = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://". $_SERVER['SERVER_NAME'].$port.$_SERVER['SERVER_PORT'].dirname($_SERVER["REQUEST_URI"].'?');
$server = rtrim($server2, "/busqueda");
$localhost = (strlen($server)-1);
return [
'pathServer' => ($server[$localhost] == "/") ? $server : $server."/",
'pathServices' => "https://canguro.pe/api/",
'pathAction' => substr(strtolower(basename($_SERVER['PHP_SELF'])),0,strlen(basename($_SERVER['PHP_SELF']))-4),
'pathPage' => (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]",
'pathQuerys' => (empty($_GET)) ? "" : $_SERVER['QUERY_STRING']
];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment