note 76347 deleted from reserved.variables by felipe

From: Date: Sun, 30 Dec 2007 18:27:21 +0000
Subject: note 76347 deleted from reserved.variables by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134364@lists.php.net to get a copy of this message
Note Submitter: seb at omegasoft dot co dot uk ---- More attractive way for displaying a URL <?php function get_url($show_port = false) { if($_SERVER['HTTPS']) { $my_url = 'https://'; } else { $my_url = 'http://'; } $my_url .= $_SERVER['HTTP_HOST']; if($show_port) { $my_url .= ':' . $_SERVER['SERVER_PORT']; } $my_url .= $_SERVER['SCRIPT_NAME']; if($_SERVER['QUERY_STRING'] != null) { $my_url .= '?' . $_SERVER['QUERY_STRING']; } return $my_url; } echo get_url(); // Outputs: http://localhost/ echo get_url(true); // Outputs: http://localhost:80/ ?>

« previous php.notes (#134364) next »