Is there any specification for the division of controllers in mysql-thinkphp?

Source: Internet
Author: User
In my understanding, each function module is divided into a controller. In this way, when requirements change in the future, the modification does not affect other modules as much as possible, but some people say that all the methods of the output view are extracted and written to the IndexController controller separately, while Ind... in my understanding, each function module is divided into a controller. In this way, when requirements change in the future, the modification will not affect other modules as much as possible.

However, it is also said that all the methods of the output view are extracted and written to the IndexController controller, and the IndexController then calls the methods of other controllers. It seems that what they said makes sense.
However, if there is a change in demand in the future, the IndexController controller should also be modified, as if it violates the principle of high cohesion and low coupling. (The output view and data processing under the same function should be in the same controller)

I don't know how to divide controllers. Can anyone share their division methods and specifications.

Reply content:

In my understanding, each function module is divided into a controller. In this way, when requirements change in the future, the modification will not affect other modules as much as possible.

However, it is also said that all the methods of the output view are extracted and written to the IndexController controller, and the IndexController then calls the methods of other controllers. It seems that what they said makes sense.
However, if there is a change in demand in the future, the IndexController controller should also be modified, as if it violates the principle of high cohesion and low coupling. (The output view and data processing under the same function should be in the same controller)

I don't know how to divide controllers. Can anyone share their division methods and specifications.

Currently, thinkphp is used together in two ways.
.
| -- Login
| '-- Action
| -- IndexAction. class. php
| '-- LoginAction. class. php
| -- Query
| '-- Action
| -- AgentChargeLogAction. class. php
| -- AgentFundsLogAction. class. php
| -- IndexAction. class. php
| -- MobileTelAction. class. php
| -- OrderQueryAction. class. php
| -- ProductAction. class. php
| '-- UserAction. class. php
| -- Trade
| '-- Action
| -- CardlibAction. class. php
| -- FlowAction. class. php
| -- IndexAction. class. php
| -- QcoinsAction. class. php
| '-- TelAction. class. php

Each functional module divides a directory.
Extract all the methods of the output View to the IndexAction (Version 3.1) controller, and then call the methods of other controllers in the IndexAction controller.

It is recommended that a function module be a controller or a folder. This makes maintenance and modification easy.

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.