duan201444 2018-04-06 23:08
浏览 73
已采纳

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

The question is this, I have a development in Laravel 5.0 and developed a small module to create a pdf using the FPDF library, the issue is that my local server works correctly, but when I upload the files to my web server I throw the following error:

FatalErrorException in ProviderRepository.php line 150: Class 'Codedge\Fpdf\FpdfServiceProvider' not found

I did everything what the documentation indicates, nevertheless it still does not work correctly, I leave the code for its analysis

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,
    ],

According to the documentation I did what this page told me

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

In local it works without any problem, but online it sends the error that comments

Any help

  • 写回答

1条回答 默认 最新

  • dsieyx2015 2018-04-07 03:02
    关注

    Try to remove service provider and alias from config/app.php, then run:

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

    Then add service provider and alias back to config/app.php.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于这个复杂问题的解释说明
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败