Thinkphp3.2 defines multiple modules and sets the default module, which is the thinkphp3.2 module.

Source: Internet
Author: User

Thinkphp3.2 defines multiple modules and sets the default module, which is the thinkphp3.2 module.

Front-end entry file index. php

<? Php // + keys // | ThinkPHP [we can do it just think] // + keys // | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved. // + ------------------------------------------------------------------------ // | Licensed (http://www.apache.org/licenses/LICENSE-2.0) // + --- Tests // | Author: liu21st <liu21st@gmail.com> // + tests // application entry file // checks the PHP environment if (version_compare (PHP_VERSION, '5. 3.0 ',' <') die ('require PHP> 5.3.0! '); // Enable the debugging mode. It is recommended that you enable the annotation of the deployment phase in the development phase or set it to falsedefine ('app _ debug', True ); // define the RUNTIME directory define ('runtime _ path ','. /Runtime/'); // defines the PATH define ('html _ path ','. /Html/'); // define the application directory define ('app _ path ','. /Application/'); // define the default MODULE define ('Bind _ module', 'home'); // define the website root directory define ('web _ path ', dirname (_ FILE _); // introduce the ThinkPHP entry FILE require '. /ThinkPHP. php '; // It's so simple that no code is needed in the end

Admin. php

<? Php // + keys // | ThinkPHP [we can do it just think] // + keys // | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved. // + ------------------------------------------------------------------------ // | Licensed (http://www.apache.org/licenses/LICENSE-2.0) // + --- Tests // | Author: liu21st <liu21st@gmail.com> // + tests // application entry file // checks the PHP environment if (version_compare (PHP_VERSION, '5. 3.0 ',' <') die ('require PHP> 5.3.0! '); // Enable the debugging mode. It is recommended that you enable the annotation of the deployment phase in the development phase or set it to falsedefine ('app _ debug', True ); // define the RUNTIME directory define ('runtime _ path ','. /Runtime/'); // defines the PATH define ('html _ path ','. /Html/'); // define the application directory define ('app _ path ','. /Application/'); // define the default MODULE define ('Bind _ module', 'admin'); // define the website root directory define ('web _ path ', dirname (_ FILE _); // introduce the ThinkPHP entry FILE require '. /ThinkPHP. php '; // It's so simple that no code is needed in the end

In this way, you can easily remove the module name from the url without configuring any default modules and modules in the configuration file. Haha .. I have already tried it. Unless you only have one module, if you have multiple modules, you 'd better configure it like me ....


Does Thinkphp322 automatically generate multiple modules? Let me explain, the younger brother has no score. Sorry, big brother and sisters.

According to the HOME, ADMIN is a group, not a module. Go to the THINKPHP official manual to learn how to enable grouping and set the default grouping. Your problem is solved. It's okay. Give it a pass.

An error occurred while loading the custom module CommonModel in thinkphp.

It is clearly written in the document that M () is used for loading.
$ User = M ('commonmodel: user ');

The M method instantiates the Model class by default. The second parameter is used to specify the table prefix. The third parameter can specify other database connection information.
 

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.