本文介绍了找不到“社交名流"类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用中使用了Socialite软件包.我按照官方github页面上的所有说明进行操作.我正在使用Laravel 5.4.27.当我尝试运行该应用程序时,出现"Class 'Socialite' not found"错误.我该怎么办?

I am using Socialite package in my app. I followed all the instructions from the official github page. I am using Laravel 5.4.27. When I try to run the app, I get "Class 'Socialite' not found"error. What do I need to do??

我还添加了use Socialite;Laravel\Socialite\SocialiteServiceProvider::class,'Socialite' => Laravel\Socialite\Facades\Socialite::class,,并且我使用的是社交名媛的version 3.

I have also added use Socialite;, Laravel\Socialite\SocialiteServiceProvider::class, and 'Socialite' => Laravel\Socialite\Facades\Socialite::class, and I am using version 3 of socialite.

这里是控制器:

<?php

namespace App\Http\Controllers\Auth;

use Socialite;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class SocialLoginController extends Controller {

    public function redirectToProvider($service, Request $request) {
        return Socialite::driver($service)->redirect();
    }

    public function handleProviderCallback($service, Request $request) {

    }
}

我该怎么办?

推荐答案

尝试 composer dump-autoload

composer install 根据composer.lock安装供应商软件包(如果不存在,则创建composer.lock)

composer install installs the vendor packages according to composer.lock (or creates composer.lock if not present),

composer更新始终重新生成composer.lock并安装基于composer.json的最新版本的可用软件包

composer update always regenerates composer.lock and installs the lastest versions of available packages based on composer.json

composer dump-autoload 不会下载任何内容.它只是重新生成项目中需要包括的所有类的列表(autoload_classmap.php).当您在项目中有新课程时的理想选择.理想情况下,您可以执行composer dump-autoload -o,以更快地加载网页.它不是默认值的唯一原因是,它花费了更长的时间生成(但仅略微引人注意)

composer dump-autoload won’t download a thing. It just regenerates the list of all classes that need to be included in the project (autoload_classmap.php). Ideal for when you have a new class inside your project.Ideally, you execute composer dump-autoload -o , for a faster load of your webpages. The only reason it is not default, is because it takes a bit longer to generate (but is only slightly noticable)

还清除配置缓存:

php artisan config:clear

如果所有这些东西都无济于事,请尝试以下答案(在旧堆栈问题中查找,例如找不到社交名流"):

If all this stuff do not help, try this answer (find in old stack questions like "socialite not found"):

https://stackoverflow.com/a/28451747/7155723

希望它会对您有所帮助:)

Hope it will help you :)

这篇关于找不到“社交名流"类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 15:50