Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel Socialist如何在重定向到提供程序后在会话中保留变量_Php_Laravel_Session_Laravel Socialite - Fatal编程技术网

Php Laravel Socialist如何在重定向到提供程序后在会话中保留变量

Php Laravel Socialist如何在重定向到提供程序后在会话中保留变量,php,laravel,session,laravel-socialite,Php,Laravel,Session,Laravel Socialite,欢迎 我正在开发一个multi-lang网站,目前正在使用社交媒体登录() 问题是: 在登录Google之前,我在会话中保存了一个变量locale('en'、'fr'…等)。 但是在登录并从Google重定向到我的站点后,我发现我在会话中输入的变量值是null 使用以下代码 /* this method will redirect user from my website to google for auth */ public function redirectToGoogle

欢迎
我正在开发一个multi-lang网站,目前正在使用社交媒体登录()
问题是:
在登录Google之前,我在会话中保存了一个变量
locale
('en'、'fr'…等)。 但是在登录并从Google重定向到我的站点后,我发现我在会话中输入的变量值是
null

使用以下代码

    /* this method will redirect user from my website to google for auth */
    public function redirectToGoogleProvider()
    {
        Session::put("locale", app()->getLocale());
        return Socialite::driver('google')->redirect();
    }

    /* this method will called when auth finished */
    public function handleGoogleProviderCallback()
    {
        $locale = Session::get('locale');
        dd($locale); // output: null
    }
edit:我在使用
cookie
多谢各位