Answer the question
In order to leave comments, you need to log in
What is the best way to write code?
What is the best way to write code?
$app_path = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}";
$app_path = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$app_path = "http" . (($_SERVER['SERVER_PORT'] == 443) ? "s" : "") . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
Answer the question
In order to leave comments, you need to log in
$app_path =
'//' // просто двойной слэш будет использовать текущую схему
.'mysite.com/' // домен сайта вы знаете и он не меняется. или в константу его. или в конфиг
.$_SERVER['REQUEST_URI'];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question