3 ms·
"Router" as in URL routing. Here's an example from his page: $app->route('/pork', function($app) { return "Delicious pork."; });
by jlaurend 15y ago
"Router" as in URL routing. Here's an example from his page:
$app->route('/pork', function($app) {
return "Delicious pork.";
});
- gaius 15y agoOK, but why would you do that, instead of just having pork.cgi (or pork/index.cgi)? That "routing" is built into Apache or indeed any HTTP server!
- jasonlotito 15y agoMostly because mod_rewrite rules are fairly complicated, and the ability to put them in the server's conf file means any changes require a server restart. You could put them in .htaccess, but now your having to parse out the route every time. Using a front controller (like index.php) makes everything so much easier. Finally, you have to consider hosting support. This hasn't even touched on numerous other benefits. Yes, their are tradeoffs, but they don't overcome the benefits, not the least of which is simplicity.
- xyzzyz 15y agoIt's been long time since web developers moved away from URLs representing filesystem structure on web server.