suchen
Heimphp教程php手册最新县及县以上行政区划代码(截止2014年10月31日)

采集自国家统计局
http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201504/t20150415_712722.html
有需要的同学自行下载附件,分割入库
文件格式如下
110000,北京市###110100,市辖区###110101,东城区###110102……

数据库方面CREATE TABLE `think_region` (<br>   `id` mediumint(6) unsigned NOT NULL DEFAULT '0',<br>   `pid` mediumint(6) unsigned NOT NULL DEFAULT '0',<br>   `name` varchar(100) NOT NULL DEFAULT '',<br>   `type` tinyint(1) NOT NULL DEFAULT '0',<br>   PRIMARY KEY (`id`),<br>   KEY `type` (`type`)<br> ) ENGINE=MyISAM DEFAULT CHARSET=utf8控制器方面        $DB = M('Region');<br>         $file = './code.txt';<br>         $content = file_get_contents($file);<br>         $content = think_s2a($content, '###');<br>         $i=0;$addall=array();<br>         foreach ($content as $v) {<br>             $data = think_s2a($v);<br>             switch (true) {<br>                 case (preg_match('/\d{2}0000/', $data[0])):<br>                     $pid = 0;<br>                     $type = 0;<br>                     break;<br>                 case (preg_match('/\d{4}00/', $data[0])):<br>                     $pid = substr($data[0], 0, 2) . '0000';<br>                     $type = 1;<br>                     break;<br>                 default:<br>                     $pid = substr($data[0], 0, 4) . '00';<br>                     $type = 2;<br>             }<br>             $add = array(<br>                 'id'   => $data[0],<br>                 'pid'  => $pid,<br>                 'name' => $data[1],<br>                 'type' => $type,<br>             );<br>             $rules = array(<br>                 array('id', 'require','id必须'),<br>                 array('pid', 'require','pid必须'),<br>                 array('name', 'require','neme必须'),<br>                 array('type', array(0,1, 2), '类型范围', 1, 'in', 1),<br>                 array('id', '', '该地区已录入', 1, 'unique', 1),<br>             );<br>             if ($DB->validate($rules)->create($add, 1)) {<br>                 $addall[$i]=$DB->data();<br>                 $i++;<br>             }<br>         }<br>         $DB->addAll($addall);

附件 地区.zip ( 20.91 KB 下载:106 次 )

AD:真正免费,域名+虚机+企业邮箱=0元

Stellungnahme
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn

Heiße KI -Werkzeuge

Undresser.AI Undress

Undresser.AI Undress

KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover

AI Clothes Remover

Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool

Undress AI Tool

Ausziehbilder kostenlos

Clothoff.io

Clothoff.io

KI-Kleiderentferner

AI Hentai Generator

AI Hentai Generator

Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

R.E.P.O. Energiekristalle erklärten und was sie tun (gelber Kristall)
4 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Beste grafische Einstellungen
4 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. So reparieren Sie Audio, wenn Sie niemanden hören können
4 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat -Befehle und wie man sie benutzt
4 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌

Heiße Werkzeuge

Dreamweaver Mac

Dreamweaver Mac

Visuelle Webentwicklungstools

EditPlus chinesische Crack-Version

EditPlus chinesische Crack-Version

Geringe Größe, Syntaxhervorhebung, unterstützt keine Code-Eingabeaufforderungsfunktion

Herunterladen der Mac-Version des Atom-Editors

Herunterladen der Mac-Version des Atom-Editors

Der beliebteste Open-Source-Editor

VSCode Windows 64-Bit-Download

VSCode Windows 64-Bit-Download

Ein kostenloser und leistungsstarker IDE-Editor von Microsoft

SublimeText3 Mac-Version

SublimeText3 Mac-Version

Codebearbeitungssoftware auf Gottesniveau (SublimeText3)