thinkphp considerations for using separate groupings

Source: Internet
Author: User
Keywords thinkphp independent grouping
Tags aliyun configure development development process directory directory structure examples function

On the independent grouping of TP, the function seems very good, but the official did not give detailed examples and instructions, in this, according to my actual http://www.aliyun.com/zixun/aggregation/17799.html "> development process, Give the following notes:

1. Separate grouped directory structure.

As with official instructions, set up the Modules folder, configure config,

Note that the Independent grouping action is placed directly under the action directory and does not require a lib directory!!

This slight difference pits me a day!!

2. Mutual invocation between independent groupings:

If you set up a separate group to deal specifically with data additions and deletions, and other methods of grouping calls this group of additions and deletions to check the method, you will find many miracles, such as a variety of non-existent hints, model validation inexplicable failure and so on. This all boils down to one reason: does not automatically load the corresponding module!!
So, give up the official a method and load all the modules yourself, for example:

Import (' Action.mcorpworkeraction ', App_path. ' Modules/base ');//Load the action of the Base module
Import (' Model.corpworkermodel ', App_path. ' Modules/base ');
You load the base module model, or automatic verification and so on model method will fail
$Mworker = new Mcorpworkeraction (); Instantiate action, pay attention to write it all
$worker ["LoginName"] =$_request[' loginname '];
$worker ["Realname"] =$_request[' realname '];
$worker ["Pass"] =mmin ($_request[' Pass '));
Add after constructing data
$r = $Mworker->addfun ($worker);
In order to successfully invoke the base module of the Mcorpworker to check and delete!!

Remember to be aware of separate groupings.
If the official has any good instructions, welcome to make bricks! More looking forward to improvement.

Related Article

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.