Re: Question about losing port number

From: Date: Mon, 26 Sep 2011 23:16:48 +0000
Subject: Re: Question about losing port number
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-315034@lists.php.net to get a copy of this message
On 09/26/2011 05:45 PM, vince chan wrote: > Hi: > I have a general question about PHP: > So basically I have a link, and I want the href to be absolute., so I > do 'https://' . $_SERVER['HTTP_HOST'] . > '/login' ; this gives me > https://127.0.0.1/login on my local; however, what i really > want is > https://127.0.0.1:9090/login, it is missing ":9090". > I also have tried to > use $_SERVER['SERVER_PORT'], but $_SERVER['SERVER_PORT'] doesn't > give me > 9090, it gives me 80. > > Could anyone help me? > Thx > I the page that you are on is connected via port 80 then $_SERVER['SERVER_PORT'] will be 80. If it is connected via 9090 then $_SERVER['SERVER_PORT'] will be 9090. If you want it to be different than how it is currently connected then you will have to hard code the port number in the href. -- Thanks! -Shawn http://www.spidean.com

« previous php.general (#315034) next »