PatrickLouys / no-framework-tutorial

A small tutorial to show how to create a PHP application without a framework.
MIT License
1.53k stars 188 forks source link

router example throws exception #67

Open hesna opened 6 years ago

hesna commented 6 years ago

Running current code for Router section results in following error: Cannot modify header information - headers already sent

It is caused by echo statements in route resolvers and can be fixed if resolvers return content instead.

As it is, one cannot finish this section without an exception page. Is this behavior intentional?

tylerlazenby commented 4 years ago

I wonder if this is what he meant to say but never did.

"Comment out this code until next step"

foreach ($response->getHeaders() as $header) {
    header($header, false);
}
echo $response->getContent();
Wondarar commented 2 years ago

I'm confused and lost between step 5 and 6. What am I supposed to see after implementing all code from step5? The 404 page message still? Because that's what I get..... I doubt it's supposed to be like this.