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

    • <bdo id='2NjOH'></bdo><ul id='2NjOH'></ul>

    <small id='2NjOH'></small><noframes id='2NjOH'>

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

        使用 Redis 存儲數據數組(來自 Laravel)

        Storing an array of data using Redis (from Laravel)(使用 Redis 存儲數據數組(來自 Laravel))
              <tbody id='4KZNe'></tbody>
          1. <i id='4KZNe'><tr id='4KZNe'><dt id='4KZNe'><q id='4KZNe'><span id='4KZNe'><b id='4KZNe'><form id='4KZNe'><ins id='4KZNe'></ins><ul id='4KZNe'></ul><sub id='4KZNe'></sub></form><legend id='4KZNe'></legend><bdo id='4KZNe'><pre id='4KZNe'><center id='4KZNe'></center></pre></bdo></b><th id='4KZNe'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='4KZNe'><tfoot id='4KZNe'></tfoot><dl id='4KZNe'><fieldset id='4KZNe'></fieldset></dl></div>
          2. <tfoot id='4KZNe'></tfoot>
          3. <small id='4KZNe'></small><noframes id='4KZNe'>

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

                  本文介紹了使用 Redis 存儲數據數組(來自 Laravel)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我已經開始使用 Laravel.工作很有趣.我已經開始使用 Laravel 的功能了.我已經開始使用 redis 通過在我的系統中安裝 redis 服務器并更改 app/config/database.php 文件中的 redis 配置.通過使用 set,redis 可以很好地處理單個變量.即,

                  $redis = Redis::connection();$redis->set('name', 'Test');

                  我可以通過使用獲得價值

                  $redis->get('name');

                  但我想使用 set 函數來設置數組.如果我嘗試這樣做,則會出現以下錯誤

                   strlen() 期望參數 1 是字符串,給定數組

                  我已嘗試使用以下代碼.

                  $redis->set('name', array(5, 10));$values = $redis->lrange('names', array(5, 10));

                  如果我使用

                  $values = $redis->command('lrange', array(5, 10));

                  出現以下錯誤

                   'command' 不是注冊的 Redis 命令

                  任何人都可以向我解釋這個問題嗎?redis 可以嗎?...我們可以使用 redis 設置數組值嗎?

                  解決方案

                  這已經在評論中回答了,但為了讓以后訪問的人更清楚地回答.

                  Redis 與語言無關,因此它不會識別特定于 PHP 或任何其他語言的任何數據類型.最簡單的方法是 serialise/json_encode 數據集,然后 unserialise/json_decode 獲取.

                  使用 json_encode 存儲數據的示例:

                  使用 IlluminateSupportFacadesRedis;$redis = Redis::connection();$redis->set('user_details', json_encode(['first_name' =>'亞歷克斯','姓氏' =>理查茲"]));

                  使用 json_decode 檢索數據的示例:

                  使用 IlluminateSupportFacadesRedis;$redis = Redis::connection();$response = $redis->get('user_details');$response = json_decode($response);

                  I have started to work with laravel. It is quite interesting to work. I have started to use the features of laravel. I have started to use redis by install redis server in my system and change the configuration for redis in app/config/database.php file. The redis is working fine for the single variables by using set. i.e.,

                  $redis = Redis::connection();
                  
                  $redis->set('name', 'Test');
                  

                  and i could able to get the value by using

                  $redis->get('name');
                  

                  But i want to set the array by using set function. If i try do that getting the following error

                   strlen() expects parameter 1 to be string, array given 
                  

                  I have tried by using following codes.

                  $redis->set('name', array(5, 10));
                  
                  $values = $redis->lrange('names', array(5, 10));
                  

                  and if i use

                  $values = $redis->command('lrange', array(5, 10));
                  

                  getting the following error

                   'command' is not a registered Redis command 
                  

                  Can any one explain me the problem and is that possible with redis?...we can set the array values using redis ?

                  解決方案

                  This has been answered in the comments but to make the answer clearer for people visiting in the future.

                  Redis is language agnostic so it won't recognise any datatype specific to PHP or any other language. The easiest way would be to serialise / json_encode the data on set then unserialise/json_decode on get.

                  Example to store data using json_encode:

                  use IlluminateSupportFacadesRedis;
                  
                  $redis = Redis::connection();
                  
                  $redis->set('user_details', json_encode([
                          'first_name' => 'Alex', 
                          'last_name' => 'Richards'
                      ])
                  );
                  

                  Example to retrieve data using json_decode:

                  use IlluminateSupportFacadesRedis;
                  
                  $redis    = Redis::connection();
                  $response = $redis->get('user_details');
                  
                  $response = json_decode($response);
                  

                  這篇關于使用 Redis 存儲數據數組(來自 Laravel)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='bfbUN'></small><noframes id='bfbUN'>

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

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

                          • 主站蜘蛛池模板: 欧美日韩高清 | 国产精品日女人 | 国产精品a免费一区久久电影 | 欧美日本在线观看 | 精品免费av | www天天操 | 台湾佬伊人 | 日韩www | 日韩美女一区二区三区在线观看 | 日韩精品一区二区三区高清免费 | 久久久毛片 | 欧美日韩精品免费观看 | 久久精品亚洲精品国产欧美 | 精品无码久久久久久国产 | 毛片一级片 | 成人精品一区二区三区中文字幕 | 91大神在线看 | 国产精品免费一区二区三区 | 99久久精品免费看国产高清 | 欧美日韩不卡在线 | 日韩在线看片 | 欧美国产激情二区三区 | 亚洲 中文 欧美 日韩 在线观看 | 少妇一级淫片aaaaaaaaa | 国产一二三视频在线观看 | 97精品一区二区 | 亚洲国产一区二区三区 | 日韩精品a在线观看图片 | 亚洲精品乱码久久久久久蜜桃91 | 欧美久久一级 | 9999精品视频| 日本在线免费看最新的电影 | 正在播放国产精品 | 午夜精品一区 | 亚洲视频在线观看 | 成人a免费 | 亚洲中午字幕 | 国产一区二区三区免费 | 在线观看国产视频 | 日韩精品一区二区三区老鸭窝 | 精品一二区 |