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.