


Solve the problem that app\controller\Index does not exist in ThinkPHP6 controller
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:
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
<?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等文件使用的常量 'SITE_URL' //define('SITE_URL','http://'.$_SERVER['HTTP_HOST']); // 加载composer的psr4命名规范 require __DIR__ . '/../vendor/autoload.php'; // 执行HTTP应用并响应 创建核心类 获取执行用户所发送请求的http类 $http = (new App())->http; // 运行用户的请求 //$response = $http->run(); // 运行用户的请求 多应用(设置admin应用) $response = $http->name('admin')->run(); // 响应用户的请求 $response->send(); // 结束 $http->end($response);

in the browser. Solution two:
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__ . '/../vendor/autoload.php';
// 执行HTTP应用并响应 创建核心类 获取执行用户所发送请求的http类
$http = (new App())->http;
// 运行用户的请求
$response = $http->run();
// 运行用户的请求 多应用(设置admin应用)
//$response = $http->name('admin')->run();
// 响应用户的请求
$response->send();
// 结束
$http->end($response);
2. Modify the app.php file
##Solution 3: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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
