Ive used a common approach to a custom MVC pattern
controller/action/param
$controller->action($param)
How can I implement a method of redirecting i.e. using header() because theres always an initial output from the main controller but Im not intentionally outputting anything.
NOT INTERESTED IN USING POPULAR FRAMEWORKS AND IM NOT TRYING TO REINVENT THE WHEEL JUST TRYING TO LEARN.
you can enable output buffering to store the initial output and flush it after the header function
or you can use javascript to redirect:
EDIT:
There is a common case when writing class, you accidentally leave a whitespace after the closing
?>tag, maybe it’s causing the output.to avoid such accidents just leave out the closing
?>, it’s completely legal, unless you have only php in your file.