Studying the principle of MVC , I did this: there is a view variable that receives a certain value and the get method passes this value to the index.php page. For example: index.php?view=articles&id=4 . Further, index.php , analyzing the het-variables, generates this or that page. However, looking at sites (and hashcode), I do not see it. In the address bar there is something like https://ru.stackoverflow.com/questions/ask/ , so the link to the internal index.php .

How does all this work? How does data transfer and page generation occur?

  • usually use frameworks, for example CodeIgniter generally by default works with exactly such url, here's a demo like the one done in 5 minutes doduts.comoj.com (and yes the magic word is RewriteRule) - zb '16
  • frameworks are good, the demo is incomprehensible. How it works? I can write a <a href="somesite/dir/otherpage/> transition </a> in the link. But how will otherpage / index.php "know about the header, the basement of the site and in general what to generate. I would learn the principle of this work. - Deus
  • Archive is there, everything is there, you are interested in the file router.php, - true, Deus, in that no otherpage / index.php exists - zb '16
  • one
    what is this all about? There code 59 lines - zb '16
  • 2
    @Deus, in the comments, the text is drawn up in the same way as in the answers / questions . You can see in ? located in a row of tools wmd editor. - Deleted

1 answer 1

If the English language is less tolerant, then I can recommend to read this cycle of articles http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part -1 There are 12 parts, it tells how to create your own framework based on Symfony2 components, as well as all the key points: class autoloading, request-response, routing , work with events.

Your question is routing .