witam. w jaki sposób zapisać do zmiennej nazwe domeny na której działa skrypt ?
czyli np odpalam skrypt przez www.jakas.strona.pl
i chce aby w zmiennej znalazł sie właśnie ten adres
Metoda zwraca nazwę domeny razem https jeśli połączenie jest szyfrowane i podkatalogiem skryptu czyli np. https://www.domena.com/podkatalog/skrypt.php
/** * Returns full domain name with subdirectory * @staticvar string $sDomain * @return string */ { { // Delete file name $sFilePath = $_SERVER['SCRIPT_FILENAME']; // Get only part without document root directory path // Compare and retrive subdirectories that exists in both arrays $aCommon = array_intersect(explode('/', $sFilePath), explode('/', trim($_SERVER['REQUEST_URI'], '/'))); // Are we using secure connection // Glue everything together } return $sDomain; }