Table of Contents
(1), multiple applications are not configured" >1. Reason for the error: controller Index class was not found, reasons: (1), multiple applications are not configured
Home PHP Framework ThinkPHP Solve the problem that app\controller\Index does not exist in ThinkPHP6 controller

Solve the problem that app\controller\Index does not exist in ThinkPHP6 controller

May 19, 2021 pm 02:13 PM
thinkphp6

The following tutorial column will introduce to you how to solve the problem that the ThinkPHP6 controller does not exist: app\controller\Index. I hope it will be helpful to friends who need it! 1. Check the error first.

Solution 1: Solve the problem that app\controller\Index does not exist in ThinkPHP6 controller

1. Reason for the error: controller Index class was not found, reasons: (1), multiple applications are not configured

(2), the namespace is incorrect

(3), the entry file runs by default The user requested no configuration

(4),

Remarks (multi-application)

: Need to install the multi-application mode extension think-multi-app

Command line: composer require topthink/ think-multi-app2. Solution:

(1). In config/app.php, change 'auto_multi_app' => flase, to true;

(2), check whether the namespace of the controller class is correct

Solve the problem that app\controller\Index does not exist in ThinkPHP6 controller

(3), modify the entry file

<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// [ 应用入口文件 ]
namespace think;
//定义引用css、js等文件使用的常量 &#39;SITE_URL&#39;
//define(&#39;SITE_URL&#39;,&#39;http://&#39;.$_SERVER[&#39;HTTP_HOST&#39;]);

// 加载composer的psr4命名规范
require __DIR__ . &#39;/../vendor/autoload.php&#39;;

// 执行HTTP应用并响应 创建核心类 获取执行用户所发送请求的http类
$http = (new App())->http;

// 运行用户的请求
//$response = $http->run();
// 运行用户的请求 多应用(设置admin应用)
$response = $http->name(&#39;admin&#39;)->run();
// 响应用户的请求
$response->send();
// 结束
$http->end($response);
Copy after login
Solve the problem that app\controller\Index does not exist in ThinkPHP6 controller

Finally, visit

Solve the problem that app\controller\Index does not exist in ThinkPHP6 controller

in the browser. Solution two: Solve the problem that app\controller\Index does not exist in ThinkPHP6 controller

1. No need to modify the index.php file
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// [ 应用入口文件 ]
namespace think;

// 加载composer的psr4命名规范
require __DIR__ . &#39;/../vendor/autoload.php&#39;;

// 执行HTTP应用并响应 创建核心类 获取执行用户所发送请求的http类
$http = (new App())->http;

// 运行用户的请求
$response = $http->run();
// 运行用户的请求 多应用(设置admin应用)
//$response = $http->name(&#39;admin&#39;)->run();

// 响应用户的请求
$response->send();

// 结束
$http->end($response);
Copy after login
2. Modify the app.php file

##Solution 3:

Solve the problem that app\controller\Index does not exist in ThinkPHP6 controller

Full path with entry file access (eg): domain name/index.php/application name/controller name/method name

The above is the detailed content of Solve the problem that app\controller\Index does not exist in ThinkPHP6 controller. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24