久久久久久久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 存儲(chǔ)數(shù)據(jù)數(shù)組(來(lái)自 Laravel)

        Storing an array of data using Redis (from Laravel)(使用 Redis 存儲(chǔ)數(shù)據(jù)數(shù)組(來(lái)自 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 存儲(chǔ)數(shù)據(jù)數(shù)組(來(lái)自 Laravel)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我已經(jīng)開(kāi)始使用 Laravel.工作很有趣.我已經(jīng)開(kāi)始使用 Laravel 的功能了.我已經(jīng)開(kāi)始使用 redis 通過(guò)在我的系統(tǒng)中安裝 redis 服務(wù)器并更改 app/config/database.php 文件中的 redis 配置.通過(guò)使用 set,redis 可以很好地處理單個(gè)變量.即,

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

                  我可以通過(guò)使用獲得價(jià)值

                  $redis->get('name');

                  但我想使用 set 函數(shù)來(lái)設(shè)置數(shù)組.如果我嘗試這樣做,則會(huì)出現(xiàn)以下錯(cuò)誤

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

                  我已嘗試使用以下代碼.

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

                  如果我使用

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

                  出現(xiàn)以下錯(cuò)誤

                   'command' 不是注冊(cè)的 Redis 命令

                  任何人都可以向我解釋這個(gè)問(wèn)題嗎?redis 可以嗎?...我們可以使用 redis 設(shè)置數(shù)組值嗎?

                  解決方案

                  這已經(jīng)在評(píng)論中回答了,但為了讓以后訪問(wèn)的人更清楚地回答.

                  Redis 與語(yǔ)言無(wú)關(guān),因此它不會(huì)識(shí)別特定于 PHP 或任何其他語(yǔ)言的任何數(shù)據(jù)類(lèi)型.最簡(jiǎn)單的方法是 serialise/json_encode 數(shù)據(jù)集,然后 unserialise/json_decode 獲取.

                  使用 json_encode 存儲(chǔ)數(shù)據(jù)的示例:

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

                  使用 json_decode 檢索數(shù)據(jù)的示例:

                  使用 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);
                  

                  這篇關(guān)于使用 Redis 存儲(chǔ)數(shù)據(jù)數(shù)組(來(lái)自 Laravel)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

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

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

                          • 主站蜘蛛池模板: 五月激情综合网 | 日韩成人av在线 | 成人免费一区二区三区视频网站 | 午夜视频网站 | 国产日韩一区二区三免费高清 | 日韩在线电影 | 丁香五月网久久综合 | 欧美黄色一级毛片 | 欧美精品一区二区三区四区 | 国户精品久久久久久久久久久不卡 | 久久久久久一区 | av在线伊人 | 久草视频网站 | 欧美日韩在线视频一区 | 亚洲福利一区二区 | 伊人激情综合网 | 久久激情视频 | 国产精品日产欧美久久久久 | 日韩欧美在线观看视频 | 亚洲成人一区二区三区 | 精品av天堂毛片久久久借种 | 中文字幕日韩欧美一区二区三区 | 久久精品免费观看 | 99re热精品视频国产免费 | 一区精品视频 | 亚洲天堂久久 | 免费在线观看av网址 | 日韩亚洲欧美综合 | 精品综合久久 | 免费黄色大片 | 成人免费毛片在线观看 | 亚洲国产精品一区在线观看 | 一区二区在线不卡 | 99精品国产一区二区三区 | 国产精品亚洲片在线播放 | 国产精品久久欧美久久一区 | 国产日韩精品在线 | 一起操网站 | 福利片在线观看 | 激情五月婷婷综合 | 亚洲成人国产 |