windows上OK,移植到linux上报错 找不到supportDB

达达尼黑

问题描述

简单尝试搭建了demo,官网的数据库教程,安装的是
composer require -W illuminate/database illuminate/pagination illuminate/events symfony/var-dumper laravel/serializable-closure

window上能正常返回数据库数据,linux上不行,报错。
数据库是使用的.env配置
数据库是mysql

程序代码

<?php
namespace app\controller;

use support\Request;
use support\Log;
use support\DB;
use support\Cache;
use app\model\GraphicCode;

class UserController
{
    public function all(Request $request)
    {
        Log::info('hello');
        $users = DB::table('user')->get();
        // Cache::set('num', '99');
        Cache::delete('num');
        return view('user/all', ['users' => $users]);
    }

报错信息

Error: Class "support\DB" not found in /data/html/webman1/app/controller/UserController.php:14
Stack trace:
#0 /data/html/webman1/vendor/workerman/webman-framework/src/App.php(335): app\controller\UserController->all(Object(support\Request))
#1 /data/html/webman1/vendor/workerman/webman-framework/src/App.php(148): Webman\App::Webman\{closure}(Object(support\Request))
#2 /data/html/webman1/vendor/workerman/workerman/src/Connection/TcpConnection.php(677): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request))
#3 [internal function]: Workerman\Connection\TcpConnection->baseRead(Resource id #138, true, NULL)
#4 /data/html/webman1/vendor/workerman/workerman/src/Events/Event.php(248): EventBase->loop()
#5 /data/html/webman1/vendor/workerman/workerman/src/Worker.php(1735): Workerman\Events\Event->run()
#6 /data/html/webman1/vendor/workerman/workerman/src/Worker.php(1537): Workerman\Worker::forkOneWorkerForLinux(Object(Workerman\Worker))
#7 /data/html/webman1/vendor/workerman/workerman/src/Worker.php(1517): Workerman\Worker::forkWorkersForLinux()
#8 /data/html/webman1/vendor/workerman/workerman/src/Worker.php(585): Workerman\Worker::forkWorkers()
#9 /data/html/webman1/vendor/workerman/webman-framework/src/support/App.php(152): Workerman\Worker::runAll()
#10 /data/html/webman1/start.php(5): support\App::run()
#11 {main}

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

截图

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

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.1 LTS"

PHP 8.3
"php": ">=8.0",
"workerman/webman-framework": "^1.6.8",

122 1 0
1个回答

咸鱼.php
use support\DB;

改成

use support\Db;
  • 达达尼黑 5天前

    擦...果然,谢谢!
    怎么想起最初搞 TP时 切到linux时大小写差异的问题了

  • liziyu 4天前

    一个大B一个小b,哈哈

×
🔝