【问题标题】:PHP Fatal error: Class 'Illuminate\Support\ServiceProvider' not foundPHP 致命错误:找不到类 'Illuminate\Support\ServiceProvider'
【发布时间】:2019-05-22 12:39:56
【问题描述】:

我试图从我的网站向第三方发出发布请求。我想测试并查看请求的结果,所以我将它作为 Route::get 添加到我的 web.php 中,我访问了 url,我得到了这个错误

  "UserId" : "UserId",
  "Password" : "Password",
  "Identity" : "Identity",
  "Amount" : 0.0,
  "Currency" : null,
  "TransactionId" : null,
  "RedirectURL" : null,
  "PaymentType" : null,
  "MobileNo" : null,
  "Email" : null
  "UserId" : "UserId",
  "Password" : "Password",
  "Identity" : "Identity",
  "Amount" : 0.0,
  "Currency" : null,
  "TransactionId" : null,
  "RedirectURL" : null,
  "PaymentType" : null,
  "MobileNo" : null,
  "Email" : null
Error: PHP Fatal error: Class 'Illuminate\Support\ServiceProvider' not found in vendor\laravel\framework\src\Illuminate\Events\EventServiceProvider.php on line 8

我尝试进行作曲家更新、作曲家安装、php artisan clear-compiled 和作曲家转储自动加载。无论我在网站上走到哪里,我仍然遇到同样的错误。即使当我重新运行 php artisan serve 时...我一直收到错误,甚至没有命令完成他们的工作。

public function zainToken()
    {
        $data1 = ['UserId' => 'myid','Password' => 'mypw',
            'Identity' => 'my_identification','Amount' => 0.0, 'Currency' => 'JOD','TransactionId' => null,'RedirectURL'=> null,'PaymentType' => null,'MobileNo' => null,'Email'=>null];

        $curl = curl_init();

        curl_setopt($ch, CURLOPT_URL,"theURlhere");
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS,
            $data1);

        $response = curl_exec($curl);
        $err = curl_error($curl);

        curl_close($curl);
        if ($err) {
            echo "cURL Error #:" . $err;
        } else {
            print_r(json_decode($response));
        }
    }

它应该只是回显发布请求的结果...

【问题讨论】:

  • 该错误是否仅出现在该控制器中? theURIhere 是第三方 URI 吗?如果你注释掉输出(echo 和 print_r),你还会得到同样的错误吗?
  • 不。可悲的是它无处不在。我什至不能做 php artisan serve。

标签: php laravel


【解决方案1】:

请检查您最近安装的库版本,您的 laravel 版本因此受到影响。 或者服务提供者中缺少某些库

【讨论】:

  • 我也忘了添加这个: UserId" : "UserId", "Password" : "Password", "Identity" : "Identity", "Amount" : 0.0, "Currency" : null ,“TransactionId”:null,“RedirectURL”:null,“PaymentType”:null,“MobileNo”:null,“Email”:null “UserId”:“UserId”,“Password”:“Password”,“Identity”: “身份”,“金额”:0.0,“货币”:null,“TransactionId”:null,“RedirectURL”:null,“PaymentType”:null,“MobileNo”:null,“Email”:null 它给了我这个错误也是。我不知道为什么会出现这个错误。我的数据变量不同
  • 你有什么需要的吗?
  • 请检查您的击球路线和错误路线
  • 我在上面的帖子中对其进行了编辑。我无法调试任何东西..我无法打开网站或做 php artisan 服务。我尝试评论该功能的路线,但它仍然无法正常工作;(
  • 检查你的 composer.json 文件并告诉我 "require": { "php": "^7.1.3", "fideloper/proxy": "^4.0", "laravel/framework": “5.7.*”、“laravel/tinker”:“^1.0”、“phpoffice/phpspreadsheet”:“^1.4”、“yajra/laravel-datatables-oracle”:“~6.0”、“maatwebsite/excel”:“ ~2.1.0" },
【解决方案2】:

嗯...我通过删除此存储库中的所有文件解决了这个问题,然后我再次克隆它......解决了它。我不确定是什么导致了这种情况发生......我可能在没有注意到的情况下编辑了一个文件,但我不这么认为,因为我已经检查了 git 历史记录的差异,而且似乎我没有这样做。

【讨论】:

    猜你喜欢
    • 2021-10-10
    • 2015-06-28
    • 2013-08-12
    • 2015-10-12
    • 2021-11-12
    • 2016-05-26
    • 2019-12-30
    • 2017-03-08
    • 2020-01-24
    相关资源
    最近更新 更多