What's the word for PHP routing?
Reply content:
What's the word for PHP routing?
What you call a router is actually a reason to accept the request through a portal and then distribute the request to a different place through the (URL) matching rules. specifically to some mainstream frameworks, the router module parses the request with an HTTP module, parses the route according to a certain rule, and then uses the dispatch module to adjust the logic to a block of code (usually the controller) and finally to return the response (Response).
So you take this route as the router that the home uses to surf the net, the reason is same.
For example, the user's access link is detected, http://fuck.io/article/1
it will be called ArticleController
showArticle($id)
, and the latter as a 1
parameter passed in assigned to $id
.
The definition of the route itself is the message-passing person, and here is the meaning of the road to the request.
The URL is assigned to the corresponding processing logic
The so-called route is currently a popular single-entry site , We only access this file: index.php , such as our access to HTTP// domain name/index.php?class=xxxx& Method=xxxxx means to execute a certain method within a class. Different parameters, then the method of execution is different. See, all that stuff is based on the parameters passed in to execute those code.
Routing is a intersection with a lot of intersections, different people from different routes (different URLs) came here, through the traffic police to their directions (route distribution), have found his way, ran their destination.
Originally written PHP program called URL, but this call not enough on the grade, and then out of more than 300 PHP framework, called routing, URL immediately high-end atmospheric grade