久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='0Y12Z'><style id='0Y12Z'><dir id='0Y12Z'><q id='0Y12Z'></q></dir></style></legend>

    <tfoot id='0Y12Z'></tfoot>

    <small id='0Y12Z'></small><noframes id='0Y12Z'>

    • <bdo id='0Y12Z'></bdo><ul id='0Y12Z'></ul>
  1. <i id='0Y12Z'><tr id='0Y12Z'><dt id='0Y12Z'><q id='0Y12Z'><span id='0Y12Z'><b id='0Y12Z'><form id='0Y12Z'><ins id='0Y12Z'></ins><ul id='0Y12Z'></ul><sub id='0Y12Z'></sub></form><legend id='0Y12Z'></legend><bdo id='0Y12Z'><pre id='0Y12Z'><center id='0Y12Z'></center></pre></bdo></b><th id='0Y12Z'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0Y12Z'><tfoot id='0Y12Z'></tfoot><dl id='0Y12Z'><fieldset id='0Y12Z'></fieldset></dl></div>

      Laravel 使用 Redis 驅動程序的所有會話 ID

      Laravel all sessions IDs with Redis driver(Laravel 使用 Redis 驅動程序的所有會話 ID)

        <small id='Q9GS9'></small><noframes id='Q9GS9'>

      1. <tfoot id='Q9GS9'></tfoot>
        • <bdo id='Q9GS9'></bdo><ul id='Q9GS9'></ul>

          1. <legend id='Q9GS9'><style id='Q9GS9'><dir id='Q9GS9'><q id='Q9GS9'></q></dir></style></legend>
              <i id='Q9GS9'><tr id='Q9GS9'><dt id='Q9GS9'><q id='Q9GS9'><span id='Q9GS9'><b id='Q9GS9'><form id='Q9GS9'><ins id='Q9GS9'></ins><ul id='Q9GS9'></ul><sub id='Q9GS9'></sub></form><legend id='Q9GS9'></legend><bdo id='Q9GS9'><pre id='Q9GS9'><center id='Q9GS9'></center></pre></bdo></b><th id='Q9GS9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Q9GS9'><tfoot id='Q9GS9'></tfoot><dl id='Q9GS9'><fieldset id='Q9GS9'></fieldset></dl></div>

                  <tbody id='Q9GS9'></tbody>
                本文介紹了Laravel 使用 Redis 驅動程序的所有會話 ID的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                在我的應用程序中,我希望允許某些用戶退出除他/她之外的所有其他用戶.我已經完成了這個功能,當會話驅動程序設置為文件時,但現在我使用 redis 作為會話驅動程序,我無法找到任何方法來列出所有當前會話,就像我在文件時所做的那樣司機.

                In my application I want to allow for some user, to be able to sign out all other users except him/her. I have done this functionality, well, when the Session driver was set to file, but now I'm using redis as session driver and I could not able to find any way to list up all current sessions like I have done when it was file driver.

                問題是:使用redis作為會話驅動時,如何列出所有會話ID?

                The question is: How to list up all sessions IDs when using redis as a session driver?

                以下是我在 session driver 為 file 時使用的代碼:

                The following is the code that I have used when session driver was file:

                public function signoutAllUsers(Request $request,$sesId=null){
                        //dd(session());
                        if ($sesId == session()->getId()){
                            $dir = storage_path().'/framework/sessions';
                            $files = scandir($dir);
                            foreach ($files as $file){
                                if ($file == session()->getId() || strpos($file,'.') !== false){
                                    //echo "ggg";
                                    continue;
                                }
                                try{
                                    unlink($dir.'/'.$file);
                                }
                                catch(Exception $e){
                                    return $e;
                                }                
                
                            }
                            $request->session()->flash('status','success');
                            $request->session()->flash('msg',__('All users have been signed out successfully'));
                            return redirect('/method/create');
                
                        }
                        else{
                            return redirect('/method/create');
                        }
                
                    }
                

                更新

                我找到了一個有限的解決方案,它依賴于 Redis 門面方法 command:

                <代碼>Redis::command('keys',['*'])但是,它返回的輸出如下所示:

                Redis::command('keys',['*']) However, it returns output looks like:

                <代碼>數組:4 [▼0 =>laravel:cav17Job1_7l46wAdE2--__"1 =>laravel:cav17Job1_7l46wAdE2--_"2 =>laravel:WwerTYmw2VNAfR5nKj3OOGBp2hKytSBK4MWMJ2P9"3 =>laravel:12tyuwzoFhXPM4f6w4yRPxrYywPon4W41neq6gu"]上面的輸出包含會話 ID 和其他緩存條目,在我的應用程序中,我也使用 Redis 進行緩存.

                array:4 [▼ 0 => "laravel:cav17Job1_7l46wAdE2--__" 1 => "laravel:cav17Job1_7l46wAdE2--_" 2 => "laravel:WwerTYmw2VNAfR5nKj3OOGBp2hKytSBK4MWMJ2P9" 3 => "laravel:12tyuwzoFhXPM4f6w4yRPxrYywPon4W41neq6gu" ] The above output contains both sessions ids and other cache entries, in my application I am using Redis for cache too.

                問題變成了,我如何給存儲在 redis 中的會話提供不同于作為緩存鍵的 laravel 的鍵?

                The question becomes, How could I give sessions stored in redis, different key other than laravel which is the cache key?

                推薦答案

                保持 sessioncache 分開.

                在文件configdatabase.php

                您可以設置多個 redis 連接,默認情況下有一個"default" 但您可以添加更多連接

                You can set many redis connections, by default there is a "default" but you can add more to it

                假設你創建了 'session-connection''cache-connection'

                現在你需要利用它

                轉到文件'configsession.php'

                go to file 'configsession.php'

                并將其設置為 'connection' =>'會話連接',

                然后轉到文件 configcache.php

                并將其設置為

                    'redis' => [
                        'driver'     => 'redis',
                        'connection' => 'cache-connection',
                    ],
                

                現在你可以得到你的 redis 會話記錄.

                and now you can get your redis session records.

                use IlluminateSupportFacadesRedis;
                Log::debug( Redis::connection('session-connection')->keys('*') );
                

                這篇關于Laravel 使用 Redis 驅動程序的所有會話 ID的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                PHP PDO ODBC connection(PHP PDO ODBC 連接)
                Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                • <small id='t88AT'></small><noframes id='t88AT'>

                • <tfoot id='t88AT'></tfoot>
                      <tbody id='t88AT'></tbody>

                    1. <i id='t88AT'><tr id='t88AT'><dt id='t88AT'><q id='t88AT'><span id='t88AT'><b id='t88AT'><form id='t88AT'><ins id='t88AT'></ins><ul id='t88AT'></ul><sub id='t88AT'></sub></form><legend id='t88AT'></legend><bdo id='t88AT'><pre id='t88AT'><center id='t88AT'></center></pre></bdo></b><th id='t88AT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='t88AT'><tfoot id='t88AT'></tfoot><dl id='t88AT'><fieldset id='t88AT'></fieldset></dl></div>

                          <bdo id='t88AT'></bdo><ul id='t88AT'></ul>
                          <legend id='t88AT'><style id='t88AT'><dir id='t88AT'><q id='t88AT'></q></dir></style></legend>

                        • 主站蜘蛛池模板: 毛片com | 国产精品视频在线播放 | v片网站| 亚洲一区二区高清 | 麻豆久久久| 国产精品久久久久久久久久免费看 | 国产精品一区二区欧美黑人喷潮水 | 成人精品一区 | 亚洲精品视频免费观看 | 一级大片网站 | 色网站在线免费观看 | 综合久久亚洲 | 中文字幕国产日韩 | av大全在线观看 | 99热在线播放 | 天天操夜夜看 | 亚洲在线| 国产福利免费视频 | 成人无遮挡毛片免费看 | 人操人人 | 91资源在线 | 欧美成人精品在线观看 | 免费日韩网站 | 中文字幕av在线 | 亚洲欧美日韩精品 | 国产日韩一区二区 | 免费黄色特级片 | 久久成人国产精品 | 国产成人在线观看免费 | 精品国产乱码久久久久久闺蜜 | 亚洲视频在线观看一区二区三区 | 亚洲视频在线观看 | 国产精品美女久久久久aⅴ国产馆 | 2021天天躁夜夜看 | 国产精品毛片一区二区三区 | 国产精品久久久久无码av | 精品欧美乱码久久久久久1区2区 | 色婷婷精品久久二区二区蜜臂av | 久久综合一区二区三区 | 波多野结衣在线观看一区二区三区 | 日韩在线91 |