FatalErrorException类' Codedge \ Fpdf \ FpdfServiceProvider'未找到

时间:2018-04-06 23:08:17

标签: php laravel fpdf

问题是这个,我在Laravel 5.0中有一个开发并开发了一个小模块来使用FPDF库创建一个pdf,问题是我的本地服务器工作正常,但当我将文件上传到我的Web服务器时抛出以下错误:

  

ProviderRepository.php第150行中的FatalErrorException:Class   ' Codedge \ FPDF \ FpdfServiceProvider'找不到

我做了文档所指示的所有内容,然而它仍然无法正常工作,我留下了用于分析的代码

composer.json

{
  "name" : "laravel/laravel",
  "description" : "The Laravel Framework.",
  "keywords": ["framework", "laravel"],
  "license": "MIT",
  "type": "project",
  "require" : {
    "laravel/framework" : "5.0.*",
    "illuminate/html" : "~5.0",
    "yajra/laravel-datatables-oracle" : ">=v4.0.1",
    "doctrine/dbal": "~2.5",
    "laracasts/testdummy": "~2.0",
    "laracasts/flash": "~1.3",
    "barryvdh/laravel-debugbar": "~2.0",
    "khill/lavacharts": "3.0.x-dev",
    "conekta/conekta-php": "dev-master",
    "codedge/laravel-fpdf": "^1.2",
    "anouar/fpdf": "^2.0"
  },
  "require-dev" : {
    "phpunit/phpunit" : "~4.0",
    "phpspec/phpspec" : "~2.1",
    "laracasts/generators": "~1.0",
    "anouar/fpdf": "1.0.2"
  },
  "autoload": {
    "classmap": [
      "database"
    ],
    "psr-4": {
      "App\\": "app/"
    }
  },
  "autoload-dev": {
    "classmap": [
      "tests/TestCase.php"
    ]
  },
  "scripts": {
    "post-install-cmd": [
      "php artisan clear-compiled",
      "php artisan optimize"
    ],
    "post-update-cmd": [
      "php artisan clear-compiled",
      "php artisan optimize"
    ],
    "post-create-project-cmd": [
      "php -r \"copy('.env.example', '.env');\"",
      "php artisan key:generate"
    ]
  },
  "config": {
    "preferred-install": "dist"
  }
}

app.php

'providers' => [
        /*
         * Application Service Providers...
         */
        Codedge\Fpdf\FpdfServiceProvider::class,
    ],
'aliases' => [
        'Fpdf' => Codedge\Fpdf\Facades\Fpdf::class,
    ],

根据文档,我做了这个页面告诉我的内容

https://github.com/codedge/laravel-fpdf

在本地,它的工作没有任何问题,但在线它会发送注释错误

任何帮助

1 个答案:

答案 0 :(得分:0)

尝试从config/app.php中删除服务提供商和别名,然后运行:

composer update
php artisan vendor:publish --provider="Codedge\Fpdf\FpdfServiceProvider" --tag=config
composer dump-autoload

然后将服务提供商和别名添加回config/app.php