PHP Route Design

Source: Internet
Author: User
When distributing PHP routes, if you want to bind a module for distribution by default, will it be better to complete the parsing or analyze it? In this case, I can configure a default module. If no special route is matched, all the controls... when distributing PHP routes, if you want to bind a module for distribution by default, will it be better to complete the parsing or analyze it?
In this case, I can configure a default module. If no route is matched, All controllers and operations point to the same module, in which logic step should I complete this process?

Reply content:

When distributing PHP routes, if you want to bind a module for distribution by default, will it be better to complete the parsing or analyze it?
In this case, I can configure a default module. If no route is matched, All controllers and operations point to the same module, in which logic step should I complete this process?

I think it should be done when parsing, because your question is not a good solution. A project may have N modules, but there is only one default module. Why should we consider the matching of the default module when the N-1 modules all fail to match?
Therefore, I think it is the parsing that matches the default module first, and then matches other modules after the failure.

The special route is written as a configuration file, which is matched one by one. The common route is followed by the corresponding module/action of PATH_INFO.
Many php frameworks provide the best routing function for rails.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.