Home> PHP Framework> ThinkPHP> body text

How to set default access path in thinkphp

Release: 2020-04-17 09:11:10
forward
5218 people have browsed it

How to set default access path in thinkphp

When using thinkphp, you usually directly access the Index method under the IndexController control. So how is it set?

ThinkPHP root directory settings

Find ThinkPHP/conf/convention.php under the root directory

'DEFAULT_MODULE' => 'Home', // 默认模块 'DEFAULT_CONTROLLER' => 'Index', // 默认控制器名称 'DEFAULT_ACTION' => 'index', // 默认操作名称
Copy after login

The meaning of these three is under the Index controller under the Home module index method.

Configuration file settings

Add a section in Common/conf/config.php

For example, I want to access the login method under the App control under Application

'DEFAULT_MODULE' => 'Aplication', // 默认模块 'DEFAULT_CONTROLLER' => 'App', // 默认控制器名称 'DEFAULT_ACTION' => 'login', // 默认操作名称
Copy after login

Same as above, it will take effect.

Recommended tutorial:thinkphp tutorial

The above is the detailed content of How to set default access path in thinkphp. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!