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.