From ddbf7c7ae0eeb933d7c1bbe8adc29a2a2825e88a Mon Sep 17 00:00:00 2001 From: "Christophe.Boulain" <> Date: Sat, 21 Feb 2009 15:59:46 +0000 Subject: Fixed Issue#96 --- framework/Web/THttpResponse.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'framework/Web') diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php index fd45acf5..81087ef7 100644 --- a/framework/Web/THttpResponse.php +++ b/framework/Web/THttpResponse.php @@ -383,6 +383,12 @@ class THttpResponse extends TModule implements ITextWriter /** * Redirect the browser to another URL and exists the current application. * This method is used internally. Please use {@link redirect} instead. + * + * @since 3.1.5 + * You can set the set {@link setStatusCode StatusCode} to a value between 300 and 399 before + * calling this function to change the type of redirection. + * If not specified, StatusCode will be 302 (Found) by default + * * @param string URL to be redirected to. If the URL is a relative one, the base URL of * the current request will be inserted at the beginning. */ @@ -392,7 +398,12 @@ class THttpResponse extends TModule implements ITextWriter $this->getApplication()->onEndRequest(); if($url[0]==='/') $url=$this->getRequest()->getBaseUrl().$url; - header('Location: '.str_replace('&','&',$url)); + if ($this->_status >= 300 && $this->_status < 400) + // The status code has been modified to a valid redirection status, send it + header('Location: '.str_replace('&','&',$url), true, $this->_status); + else + header('Location: '.str_replace('&','&',$url)); + exit(); } -- cgit v1.2.3