Code Monkey home page Code Monkey logo

taobao-area-php's Introduction

taobao-area-php

根据淘宝国家省市区,自动生成CSV和SQL文件
四级地址可选,建议通过命令行 php-cgi ./index.php 运行
四级地址执行时间略长.....大概需要 10 分钟以上
数据在 48000 条左右
通过控制台可见进度,显示数字为区县 ID
优化了原作者的 SQL 语句

说明

注意:当前目录下权限必须可写可创建文件夹和文件

执行 index.php 程序自动建立 tmp目录 ,下载淘宝省市区js文件存储为taobao-area.js,根据taobao-area.js文件 自动生成 area.csvarea.sql文件,这2个文件 就是你需要的 淘宝全套国家省市区数据

如果你不需要国家数据,把index.php中的$c->setIsCountry(true);改为$c->setIsCountry(false);,重新执行程序就是不包含国家数据的淘宝全套省市区数据

csv 使用说明

文件编码为 UTF-8格式,不能直接用Excel格式打开,需要用Excel中的数据导入功能;步骤如下:

以 Excel 2016 为例

  • 打开数据选项卡
  • 在界面中,选择 从文本
  • 在弹出的界面中选择 area.csv文件,点击确定
  • 会弹出一个警告 固定宽度字体 宋体 不存在 ,直接点击确定 忽略这个提示
  • 在会话中,选中 分隔符号,文件原始格式 Unicode(UTF-8),点击下一步
  • 分隔符选择 制表符,点击 下一步
  • 列数据格式修改,先选择 ID 列,然后选择 文本 格式,再选择 上级ID 列,然后选择 文本 格式,最后点击完成
  • 最后直接点击确定

SQL 说明

文件编码为 UTF-8

会自动创建两张表 areaarea_ext,详情请看 SQL 文件

taobao-area-php's People

Contributors

foxiswho avatar maxsky avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.