久久久久久久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>

                        • 主站蜘蛛池模板: 免费精品一区 | 久久精品国产亚洲一区二区三区 | 国产精品二区三区 | 综合久久av | 卡通动漫第一页 | 亚洲福利视频一区二区 | 黄色在线观看网站 | 国产福利视频在线观看 | 特一级黄色毛片 | 国产精品久久影院 | 中文字幕日韩一区 | 中文字幕精品一区 | 超碰人人艹 | 久久免费精品视频 | 国产精品免费在线 | 一区二区三区国产视频 | 免费看91 | 精品不卡| 一区二区三区高清不卡 | 一区二区三区免费在线观看 | 日韩国产一区二区三区 | 欧美三区视频 | 无码日韩精品一区二区免费 | 天堂va在线观看 | 久久成人18免费网站 | 中文字幕一区在线 | 日韩在线免费观看视频 | 欧美在线网站 | 福利精品 | 看羞羞视频免费 | 欧美视频一级 | 欧美一区二区三区大片 | 欧美a区 | 久久精品无码一区二区三区 | 伊人免费网 | 国产成人99 | 亚洲一区二区视频 | 在线免费观看黄色av | 国产一区二区在线播放视频 | 日韩成人高清 | 黑人巨大精品欧美一区二区免费 |