Answer the question
In order to leave comments, you need to log in
How should engines be created in PHP?
For example, if you press the registration button site.com/reg.php and if the button is friends, then site.com/friend.php, that is, the handlers are located in each file. And there are sites where it looks like this site.com/reg=ok?asd well, that is, no file names, only code and that's it. And now the question is which of them is better, can it be written as in the first example. Something got confused. I know how to code, but I don’t have the principles of creation, if you can, give a link or a book, please recommend
Answer the question
In order to leave comments, you need to log in
1) read on Wikipedia how HTTP works
2) read in the PHP documentation about SAPI
3) see how fastroute
is implemented
4) stop writing bicycles - deal with existing solutions. Then we try to write bicycles and throw them away, continuing to use ready-made solutions.
The fact that you do not see the file name in the address bar is called routing. It is usually done as follows:
All requests are sent by the web server to one file (usually index.php), and it already parses the transmitted url and routes further.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question