Re: response.redirect en PHP
| From: | Satyam | Date: | Fri, 14 May 2004 08:55:57 +0000 |
| Subject: | Re: response.redirect en PHP | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-48521@lists.php.net to get a copy of this message | ||
function Redirect($relative_url){
$dir = str_replace('\\','/',$_SERVER['PHP_SELF']);
$dir = substr($dir,0,strrpos($dir,'/'));
header("Location:
http://{$_SERVER['HTTP_HOST']}{$dir}/{$relative_url}");
exit;
}
Esto vale para ubicaciones relativas dentro del mismo servidor. Si
redireccionaras fuera del servidor, envia el header solamente, y acuerdate
del exit siempre. El reemplazo de \\ por / es por si el servidor es
Windows.
Satyam
----- Original Message -----
From: <marolijo@yahoo.es>
To: "PHP-ES" <php-es@lists.php.net>
Sent: Friday, May 14, 2004 9:36 AM
Subject: [PHP-ES] response.redirect en PHP
> Hola, como puedo hacer un response.redirect dentro del código, por ejemplo
> para redirigir si no ha llegado una variable por el query
>
> if (isset($_GET['id'])) {
> //lo que sea
> }else{
> RESPONSE.REDIRECT ""
> }
>
>
> Gracias!!!
>
> __________________________________________________
>
> PolNetwork.com
> Pol Maresma i Oliveras
> pol@polnetwork.com - webmaster@santpol.org
> Creació, manteniment i allotjament de pàgines Web
> __________________________________________________
>
> PRIVAT I CONFIDENCIAL - Aquest missatge i els document adjunts que pugui
> contenir són confidencials. Si no sou el destinatari del missatge no teniu
> permís per llegir-lo, copiar-lo ni reenviar-lo. Si heu rebut aquest
missatge
> per error, siusplau comuniqueu-ho al remitent retornant el missatge i
> esborreu les còpies del missatge i els seus documents adjunts. Aquest avís
> no pot ser eliminat.
>
> PRIVATE & CONFIDENTIAL - This email message and attachments contain
> information that is confidential. If you are not the intended recipient,
you
> are not permitted to use, copy or distribute the message and attachments
in
> any manner. If you have received this email in error, please inform the
> sender by return email immediately and delete all copies of the message
and
> its attachments. This notice should not be removed.
> __________________________________________________
>
> --
> PHP Spanish Localization Talk Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>