panique / mini

Just an extremely simple naked PHP application, useful for small projects and quick prototypes. Some might call it a micro framework :)
1.35k stars 478 forks source link

Call another controller #224

Open willianis4w opened 8 years ago

willianis4w commented 8 years ago

Hey guys!

Is it possible to call a controller from other controller?

Thank you, I really enjoy this project :)

panique commented 8 years ago

That's a good question ! :) In normal frameworks you can do this for sure, but i would go with a helper like Helper::MyHelperMethod($abc) or do a hard redirect+exit.

http://php.net/manual/en/function.header.php

btw it's important to do the exit; after doing a redirect as technically a redirect is just "asking the browser" to go somewhere else, your php process will still go on !