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 (标签-STM32|关键词-智能小车)
  • ¥20 关于#stm32#的问题,请各位专家解答!
  • ¥15 (标签-python)
  • ¥20 搭建awx,试了很多版本都有错
  • ¥15 java corba的客户端该如何指定使用本地某个固定IP去连接服务端?
  • ¥15 activiti工作流问题,求解答
  • ¥15 有人写过RPA后台管理系统么?
  • ¥15 Bioage计算生物学年龄
  • ¥20 如何将FPGA Alveo U50恢复原来出厂设置哇?
  • ¥50 cocos2d-x lua 在mac上接入lua protobuf?