I have a redirect problem within the constructor of classe
.
Next:
I have classe
:
<?php
class Constantes {
private $livre = false;
...
public function __construct () {
if($this->livre == false) {
header("Location: ".$_SERVER["SERVER_NAME"]."/manutencao.php");
exit;
}
.....
}
?>
Well, it is necessary that the redirection be done there in __construct
because I have several calls to this class and changing everything would be a huge job and a possible very difficult maintenance.
Redirection is being done. But you are duplicating the $ _ SERVER ["SERVER_NAME"] .
What to do?
Instead of leaving for
You are redirecting to