0

我的 Index.php 有两个功能。功能指标好,但功能测试不好。我不知道。

[0] HttpException in App.php line 578 控制器\控制器不存在:app\indexler\Test

    try {
        $instance = Loader::controller(
            $controller,
            $config['url_controller_layer'],
            $config['controller_suffix'],
            $config['empty_controller']
        );
    } catch (ClassNotFoundException $e) {
        throw new HttpException(404, 'controller not exists:' . $e->getClass());
    }

    // 获取当前操作名
    $action = $actionName . $config['action_suffix'];

    $vars = [];
    if (is_callable([$instance, $action])) {
        // 执行操作方法
        $call = [$instance, $action];
Call Stack
in App.php line 578
at App::module(['index', 'test', null], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], true) in App.php line 456
at App::exec(['type' => 'module', 'module' => ['index', 'test', null]], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 139
at App::run() in start.php line 19
at require('/Library/WebServer/D...') in index.php line 17
Environment Variables
GET Dataempty
POST Dataempty
Filesempty
Cookies
pgv_pvi 645735424
Sessionempty
Server/Request Data
HTTP_HOST localhost
HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_UPGRADE_INSECURE_REQUESTS 1
HTTP_COOKIE pgv_pvi=645735424
HTTP_USER_AGENT Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15
HTTP_ACCEPT_LANGUAGE zh-cn
HTTP_ACCEPT_ENCODING gzip, deflate
HTTP_CONNECTION keep-alive
PATH /usr/bin:/bin:/usr/sbin:/sbin
SERVER_SIGNATURE
SERVER_SOFTWARE Apache/2.4.29 (Unix) PHP/7.1.14
SERVER_NAME localhost
SERVER_ADDR ::1
SERVER_PORT 80
REMOTE_ADDR ::1
DOCUMENT_ROOT /Library/WebServer/Documents/tp5/public
REQUEST_SCHEME http
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT /Library/WebServer/Documents/tp5/public
SERVER_ADMIN you@example.com
SCRIPT_FILENAME /Library/WebServer/Documents/tp5/public/index.php
REMOTE_PORT 49364
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING
REQUEST_URI /index/index/test
SCRIPT_NAME /index.php
PATH_INFO /index/test
PATH_TRANSLATED /Library/WebServer/Documents/tp5/public/index.php/test
PHP_SELF /index.php/index/test
REQUEST_TIME_FLOAT 1528074339.267
REQUEST_TIME 1528074339
argv []
argc 0
Environment Variables
PATH /usr/bin:/bin:/usr/sbin:/sbin
XPC_SERVICE_NAME 0
XPC_FLAGS 0x80
XPC_SERVICES_UNAVAILABLE 1
ThinkPHP Constants
APP_PATH /Library/WebServer/Documents/tp5/public/../application/
THINK_VERSION 5.0.20
THINK_START_TIME 1528074339.2685
THINK_START_MEM 362624
EXT .php
DS /

THINK_PATH /Library/WebServer/Documents/tp5/thinkphp/

LIB_PATH /Library/WebServer/Documents/tp5/thinkphp/library/

CORE_PATH /Library/WebServer/Documents/tp5/thinkphp/library/think/

TRAIT_PATH /Library/WebServer/Documents/tp5/thinkphp/library/traits/

ROOT_PATH /Library/WebServer/Documents/tp5/

EXTEND_PATH /Library/WebServer/Documents/tp5/extend/

VENDOR_PATH /Library/WebServer/Documents/tp5/vendor/

RUNTIME_PATH /Library/WebServer/Documents/tp5/runtime/

LOG_PATH /Library/WebServer/Documents/tp5/runtime/log/

CACHE_PATH /Library/WebServer/Documents/tp5/runtime/cache/

TEMP_PATH /Library/WebServer/Documents/tp5/runtime/temp/

CONF_PATH /Library/WebServer/Documents/tp5/public/../application/

CONF_EXT .php
ENV_PREFIX PHP_
IS_CLI false
IS_WIN false
ThinkPHP V5.0.20 { 十年磨一剑-为API开发设计的高性能框架 }
4

1 回答 1

0

[0] HttpException in App.php line 578 控制器不存在:app\index\controller\Test

此错误意味着您正在尝试访问不存在的 Test 控制器。

我假设您想访问索引控制器中的测试功能,但您使用的是类似 yoursite/test 的 url。

如果是这样,您应该去 yoursite/index/test 访问它。

于 2018-10-25T15:16:25.170 回答