webman 数据库查询报错

fisha

问题描述

在使用webman查询数据表所有数据时报错,第一次用这个框架,实在没找到解决办法,希望各位大佬能帮帮忙
访问 http://127.0.0.1:8787/api/getNews 就会出现下面的报错

程序代码

控制器文件

<?php

namespace app\controller;

use support\Request;
use support\Db;

class ApiController
{
    public function getNews(Request $request)
    {
        return Db::table('api_news')->get();
    }
}

报错信息

Error: Class 'Illuminate\Database\Capsule\Manager' not found in E:\desktop\project\sharkcms\webman\vendor\workerman\webman-framework\src\support\Db.php:33
Stack trace:
#0 E:\desktop\project\sharkcms\webman\vendor\composer\ClassLoader.php(571): include()
#1 E:\desktop\project\sharkcms\webman\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile('E:\\desktop\\proj...')
#2 [internal function]: Composer\Autoload\ClassLoader->loadClass('support\\Db')
#3 E:\desktop\project\sharkcms\webman\app\controller\ApiController.php(12): spl_autoload_call('support\\Db')
#4 E:\desktop\project\sharkcms\webman\vendor\workerman\webman-framework\src\App.php(319): app\controller\ApiController->getNews(Object(support\Request))
#5 E:\desktop\project\sharkcms\webman\vendor\workerman\webman-framework\src\App.php(141): Webman\App::Webman\{closure}(Object(support\Request))
#6 E:\desktop\project\sharkcms\webman\vendor\workerman\workerman\Connection\TcpConnection.php(646): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request))
#7 E:\desktop\project\sharkcms\webman\vendor\workerman\workerman\Events\Select.php(311): Workerman\Connection\TcpConnection->baseRead(Resource id #124)
#8 E:\desktop\project\sharkcms\webman\vendor\workerman\workerman\Worker.php(1479): Workerman\Events\Select->loop()
#9 E:\desktop\project\sharkcms\webman\vendor\workerman\workerman\Worker.php(1399): Workerman\Worker::forkWorkersForWindows()
#10 E:\desktop\project\sharkcms\webman\vendor\workerman\workerman\Worker.php(560): Workerman\Worker::forkWorkers()
#11 E:\desktop\project\sharkcms\webman\vendor\workerman\webman-framework\src\support\App.php(131): Workerman\Worker::runAll()
#12 E:\desktop\project\sharkcms\webman\start.php(4): support\App::run()
#13 {main}

截图报错信息里报错文件相关代码

数据库截图
截图

数据库配置截图
截图

操作系统及workerman/webman等框架组件具体版本

windows11
Workerman version:4.1.10 PHP version:7.4.3

984 1 0
1个回答

fisha

好了,解决了

年代过于久远,无法发表回答
×
🔝