Are there any specifications for the division of controllers in mysql-thinkphp?

Source: Internet
Author: User
Keywords php laravel yii mysql thinkphp
My understanding is that each function module is divided into a controller, so that in the future when the need to change, the changes can be as far as possible without affecting other modules

But it is also seen that the method of all the output views are extracted separately to write to the Indexcontroller controller, and the Indexcontroller controller inside to call other controller methods. Think of it as if they were right.
But feel if the late demand changes, then the Indexcontroller controller also to be modified, as if it violates the principle of cohesion poly-low coupling. (should be the same function under the output view and data processing should be clustered within the same controller)

I don't know what to do now. How to divide the controller, there is no one can share their own way of partitioning and norms.

Reply content:

My understanding is that each function module is divided into a controller, so that in the future when the need to change, the changes can be as far as possible without affecting other modules

But it is also seen that the method of all the output views are extracted separately to write to the Indexcontroller controller, and the Indexcontroller controller inside to call other controller methods. Think of it as if they were right.
But feel if the late demand changes, then the Indexcontroller controller also to be modified, as if it violates the principle of cohesion poly-low coupling. (should be the same function under the output view and data processing should be clustered within the same controller)

I don't know what to do now. How to divide the controller, there is no one can share their own way of partitioning and norms.

At the moment we use thinkphp to be 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 of our function modules divides a directory.
All the methods of the output view are extracted separately to write to the Indexaction (3.1 version) controller, and the Indexaction controller inside to call the other controller method.

Suggest a function module a controller or a folder. It's easy to maintain changes

  • 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.