mysql - Can not modify header information, what is wrong with this php code -
this question has answer here:
- how fix “headers sent” error in php 11 answers
i new programming, website else had built me has stopped working. trying find out be. did read explanations complicated me dont know enough programming.
warning: cannot modify header information - headers sent (output started @ /home/username/domain/index.php:3) in /home/username/domain/controllers/register.php on line 31
the code register.php
header("location: ".url."register-missing"); // line 31 exit(); } header("location: ".url."register"); exit(); }
the code index.php
<?php class index extends controller { // line 3 function __construct() { parent::__construct(); } function index() { $this->view->render('index/index'); } } ?>
you'd have check if thing echoes or prints before header redirect called. it's practice handle header redirects @ beginning of page, before other logic executed. try avoid include files before header redirect
Comments
Post a Comment