<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 從完整地址中截取省市區 地址示例: ``` 北京市海淀區東北旺西路8號院35號樓5層501室 array(3) { ["province"] => string(9) "北京市" ["city"] => string(9) "北京市" ["area"] => string(9) "海淀區" } 貴州省遵義市習水縣發展大道 array(3) { ["province"] => string(9) "貴州省" ["city"] => string(9) "遵義市" ["area"] => string(9) "習水縣" } 貴州省遵義市赤水市旺隆鎮 array(3) { ["province"] => string(9) "貴州省" ["city"] => string(9) "遵義市" ["area"] => string(9) "赤水市" } 四川省成都市金牛區王二火鍋 array(3) { ["province"] => string(9) "四川省" ["city"] => string(9) "成都市" ["area"] => string(9) "金牛區" } ``` ## 代碼 ```php /** * 截取省市區 * * @param string $address 完整地址 * @return array [province=>'', city=>'', area=>''] */ function splitAddress($address = '重慶市海淀區東北旺西路8號院35號樓5層501室') { preg_match('/(.*?(省|自治區|市))/', $address, $matches); if (count($matches) > 1) { $province = $matches[count($matches) - 2]; if (mb_substr($province, mb_strlen($province)-1, 1) != '市') { $address = str_replace($province, '', $address); } } preg_match('/(.*?(市|自治州|地區|區劃|縣))/', $address, $matches); if (count($matches) > 1) { $city = $matches[count($matches) - 2]; $address = str_replace($city, '', $address); } preg_match('/(.*?(區|市|縣|鎮|鄉|街道))/', $address, $matches); if (count($matches) > 1) { $area = $matches[count($matches) - 2]; $address = str_replace($area, '', $address); } return [ 'province' => isset($province) ? $province : '', 'city' => isset($city) ? $city : '', 'area' => isset($area) ? $area : '', ]; } ``` ## 參考 - https://www.cnblogs.com/yimingwang/archive/2004/01/13/8855650.html
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看