Created
April 1, 2015 13:05
-
-
Save bytefade/4cce59332da22c96e21d to your computer and use it in GitHub Desktop.
Função para redirecionamento: Que funciona em todos situações, mesmo se cabeçalhos já estão enviados ou mesmo javascript está desativado.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function redirect($url) | |
{ | |
if (!headers_sent()) | |
{ | |
header('Location: '.$url); | |
exit; | |
} | |
else | |
{ | |
echo '<script type="text/javascript">'; | |
echo 'window.location.href="'.$url.'";'; | |
echo '</script>'; | |
echo '<noscript>'; | |
echo '<meta http-equiv="refresh" content="0;url='.$url.'" />'; | |
echo '</noscript>'; exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment