久久久久久久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 - 在鍵/值對中拆分字符串的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個這樣的字符串:

                  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?

                  推薦答案

                  如果你不介意使用正則表達式 ...

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

                  這篇關于PHP - 在鍵/值對中拆分字符串的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 找不到驅動程序)
                      <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>
                            主站蜘蛛池模板: 亚洲精品国产a久久久久久 午夜影院网站 | 国产美女在线观看 | 欧美综合在线观看 | 国产探花在线精品一区二区 | 91天堂 | 日本高清不卡视频 | 羞羞视频在线网站观看 | 久久视频精品 | 国产在线精品一区二区 | 黄网站在线观看 | 日韩三区 | 国产精品99| chinese中国真实乱对白 | 国产激情在线观看 | 伊人热久久 | 色综合久久久 | 日韩在线观看一区 | 伊人性伊人情综合网 | 热re99久久精品国99热观看 | 一区二区中文字幕 | 天天综合网永久 | 欧美三级在线 | 九色网址 | 激情a | 99re在线视频 | 亚洲精品视频在线播放 | av日韩一区| 日韩不卡在线 | 欧美午夜在线 | 欧美成年人视频在线观看 | 黄色片视频| 国产精品久久久久久久久 | 91极品视频| 久久久国产精品 | 欧美精品一区二区三区在线 | 精品久久久久久亚洲综合网站 | 国产精品亚洲视频 | 欧美黄色片 | 91视频网址 | 欧美专区在线 | 狠狠干狠狠操 |