What is PHP route? Is there any popular saying about PHP route?
Reply content:
What is PHP route? Is there any other popular saying?
What you call a route is actually the same as a router. It accepts requests through an ingress and distributes requests to different places through URL matching rules. Specific to some mainstream frameworks, the Router module will work with the Http module to analyze requests and parse the requests according to certain rules to match the routes, then, use the scheduling module to adjust the logic to a piece of code (usually the Controller), and finally return the Response ).
So you think of this route as a router for accessing the internet at home. The truth is the same.
For example, if the user's access link ishttp://fuck.io/article/1
To callArticleController
OfshowArticle($id)
And1
Input as a parameter and assign it$id
.
The route itself is defined as the information transmitter, which is used to direct requests.
The url is assigned to the corresponding processing logic.
The so-called route is currently popularSingle portal websiteOne way,We only access this file: index. phpFor exampleHttp: // domain name/index. php? Class = xxxx & method = xxxxxIs to execute a method in a certain class. If the input parameters are different, the execution method is different. Everything depends on the input parameters to execute the code.
A route is an intersection with many intersections. Different people come here from different routes (different URLs) and give directions to them through the traffic police (route distribution ), he found his path and ran to their destination.
The original php program is called url, but this is not a high level. Later, more than 300 php frameworks were developed and changed to routing. The url was immediately upgraded to a high level.