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

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

          <bdo id='IhER6'></bdo><ul id='IhER6'></ul>
      1. <legend id='IhER6'><style id='IhER6'><dir id='IhER6'><q id='IhER6'></q></dir></style></legend>
        <tfoot id='IhER6'></tfoot>

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

        PHP - 在鍵/值對中拆分字符串

        PHP - split String in Key/Value pairs(PHP - 在鍵/值對中拆分字符串)
        • <tfoot id='TUt2h'></tfoot>
            <legend id='TUt2h'><style id='TUt2h'><dir id='TUt2h'><q id='TUt2h'></q></dir></style></legend>
            • <bdo id='TUt2h'></bdo><ul id='TUt2h'></ul>

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

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

                  本文介紹了PHP - 在鍵/值對中拆分字符串的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有一個這樣的字符串:

                  I have a string like this:

                  鍵=值,鍵2=值2

                  我想把它解析成這樣:

                  array(
                    "key" => "value",
                    "key2" => "value2"
                  )
                  

                  我可以做類似的事情

                  $parts = explode(",", $string)
                  $parts = array_map("trim", $parts);
                  foreach($parts as $currentPart)
                  {
                      list($key, $value) = explode("=", $currentPart);
                      $keyValues[$key] = $value;
                  }
                  

                  但這似乎很荒謬.一定有什么方法可以用 PHP 更聰明地做到這一點,對嗎?

                  But this seems ridiciulous. There must be some way to do this smarter with PHP right?

                  推薦答案

                  如果你不介意使用正則表達(dá)式 ...

                  If you don't mind using regex ...

                  $str = "key=value, key2=value2";
                  preg_match_all("/([^,= ]+)=([^,= ]+)/", $str, $r); 
                  $result = array_combine($r[1], $r[2]);
                  var_dump($result);
                  

                  這篇關(guān)于PHP - 在鍵/值對中拆分字符串的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(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 可滾動游標(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 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)
                      <tbody id='W4KDw'></tbody>
                    1. <small id='W4KDw'></small><noframes id='W4KDw'>

                        <legend id='W4KDw'><style id='W4KDw'><dir id='W4KDw'><q id='W4KDw'></q></dir></style></legend>

                          <i id='W4KDw'><tr id='W4KDw'><dt id='W4KDw'><q id='W4KDw'><span id='W4KDw'><b id='W4KDw'><form id='W4KDw'><ins id='W4KDw'></ins><ul id='W4KDw'></ul><sub id='W4KDw'></sub></form><legend id='W4KDw'></legend><bdo id='W4KDw'><pre id='W4KDw'><center id='W4KDw'></center></pre></bdo></b><th id='W4KDw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='W4KDw'><tfoot id='W4KDw'></tfoot><dl id='W4KDw'><fieldset id='W4KDw'></fieldset></dl></div>
                          <tfoot id='W4KDw'></tfoot>
                          • <bdo id='W4KDw'></bdo><ul id='W4KDw'></ul>
                            主站蜘蛛池模板: 玖玖玖在线 | 亚洲国产一区在线 | 欧美一区二区三区一在线观看 | 亚洲一区二区三区免费在线观看 | 日本一二区视频 | 91精品国产91久久久久久最新 | 91中文字幕在线观看 | 热re99久久精品国产99热 | 五月婷婷激情网 | 成人影音 | 国产精品久久久久影院色老大 | 久久精品欧美一区二区三区不卡 | 中日韩毛片 | 91精品一区 | 黄色一级视频免费 | 日韩不卡在线 | 亚洲欧洲精品一区 | 中文字幕一区二区三区在线观看 | 欧洲一区二区视频 | 久久一区视频 | 日韩一区二区三区在线播放 | 91高清在线观看 | 在线观看毛片网站 | 国产亚洲第一页 | 国产日韩一区二区三免费高清 | 91tv在线观看| a在线视频 | 亚洲精品99 | 国产美女永久免费无遮挡 | 久久久久亚洲视频 | 九九亚洲精品 | 久久夜视频 | 久久精品免费 | 日韩a在线 | 免费v片在线观看 | 亚洲一区中文字幕在线观看 | 成人亚洲在线 | 亚洲一级淫片 | 国产一区二区视频在线观看 | 特一级黄色毛片 | 国产成人一区二 |