国家以及国家语言的json数据格式,提供给网友参考。
目前接触到一个需求,需要全球主要国家的选择以及语言的选择,如下图:
这是国家选项
这是语言的选项:
很简单有木有?
本来打算直接给文件,但是好像没有文件上传,所以就提供一个思路和代码,你们照着弄吧。
一、用mysql创建一张国家 countries 表,插入数据:
字段: name(国家名),abv简写(2个字母的简写),abv3(3个字母的简写),code(区号)
DROP TABLE IF EXISTS `geo_countries`; CREATE TABLE `geo_countries` ( `defunct` char(1) DEFAULT NULL, `name` varchar(100) NOT NULL, `abv` char(2) NOT NULL COMMENT 'ISO 3661-1 alpha-2', `abv3` char(3) NOT NULL COMMENT 'ISO 3661-1 alpha-3', `code` char(3) NOT NULL COMMENT 'ISO 3661-1 numeric', `slug` varchar(100) NOT NULL, PRIMARY KEY (`abv`), UNIQUE KEY `slug` (`slug`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of geo_countries -- ---------------------------- INSERT INTO `geo_countries` VALUES ('', 'Andorra', 'AD', 'AND', '20', 'andorra'); INSERT INTO `geo_countries` VALUES ('', 'United Arab Emirates', 'AE', 'ARE', '784', 'united-arab-emirates'); INSERT INTO `geo_countries` VALUES ('', 'Afghanistan', 'AF', 'AFG', '4', 'afghanistan'); INSERT INTO `geo_countries` VALUES ('', 'Antigua and Barbuda', 'AG', 'ATG', '28', 'antigua-and-barbuda'); INSERT INTO `geo_countries` VALUES ('', 'Anguilla', 'AI', 'AIA', '660', 'anguilla'); INSERT INTO `geo_countries` VALUES ('', 'Albania', 'AL', 'ALB', '8', 'albania'); INSERT INTO `geo_countries` VALUES ('', 'Armenia', 'AM', 'ARM', '51', 'armenia'); INSERT INTO `geo_countries` VALUES ('', 'Netherlands Antilles', 'AN', 'ANT', '530', 'netherlands-antilles'); INSERT INTO `geo_countries` VALUES ('', 'Angola', 'AO', 'AGO', '24', 'angola'); INSERT INTO `geo_countries` VALUES ('', 'Argentina', 'AR', 'ARG', '32', 'argentina'); INSERT INTO `geo_countries` VALUES ('', 'American Samoa', 'AS', 'ASM', '16', 'american-samoa'); INSERT INTO `geo_countries` VALUES ('', 'Austria', 'AT', 'AUT', '40', 'austria'); INSERT INTO `geo_countries` VALUES ('', 'Australia', 'AU', 'AUS', '36', 'australia'); INSERT INTO `geo_countries` VALUES ('', 'Aruba', 'AW', 'ABW', '533', 'aruba'); INSERT INTO `geo_countries` VALUES ('', 'Aland Islands', 'AX', 'ALA', '248', 'aland-islands'); INSERT INTO `geo_countries` VALUES ('', 'Azerbaijan', 'AZ', 'AZE', '31', 'azerbaijan'); INSERT INTO `geo_countries` VALUES ('', 'Bosnia and Herzegovina', 'BA', 'BIH', '70', 'bosnia-and-herzegovina'); INSERT INTO `geo_countries` VALUES ('', 'Barbados', 'BB', 'BRB', '52', 'barbados'); INSERT INTO `geo_countries` VALUES ('', 'Bangladesh', 'BD', 'BGD', '50', 'bangladesh'); INSERT INTO `geo_countries` VALUES ('', 'Belgium', 'BE', 'BEL', '56', 'belgium'); INSERT INTO `geo_countries` VALUES ('', 'Burkina Faso', 'BF', 'BFA', '854', 'burkina-faso'); INSERT INTO `geo_countries` VALUES ('', 'Bulgaria', 'BG', 'BGR', '100', 'bulgaria'); INSERT INTO `geo_countries` VALUES ('', 'Bahrain', 'BH', 'BHR', '48', 'bahrain'); INSERT INTO `geo_countries` VALUES ('', 'Burundi', 'BI', 'BDI', '108', 'burundi'); INSERT INTO `geo_countries` VALUES ('', 'Benin', 'BJ', 'BEN', '204', 'benin'); INSERT INTO `geo_countries` VALUES ('', 'Saint-Barthelemy', 'BL', 'BLM', '652', 'saint-barthelemy'); INSERT INTO `geo_countries` VALUES ('', 'Bermuda', 'BM', 'BMU', '60', 'bermuda'); INSERT INTO `geo_countries` VALUES ('', 'Brunei Darussalam', 'BN', 'BRN', '96', 'brunei-darussalam'); INSERT INTO `geo_countries` VALUES ('', 'Bolivia', 'BO', 'BOL', '68', 'bolivia'); INSERT INTO `geo_countries` VALUES ('', 'Brazil', 'BR', 'BRA', '76', 'brazil'); INSERT INTO `geo_countries` VALUES ('', 'Bahamas', 'BS', 'BHS', '44', 'bahamas'); INSERT INTO `geo_countries` VALUES ('', 'Bhutan', 'BT', 'BTN', '64', 'bhutan'); INSERT INTO `geo_countries` VALUES ('', 'Botswana', 'BW', 'BWA', '72', 'botswana'); INSERT INTO `geo_countries` VALUES ('', 'Belarus', 'BY', 'BLR', '112', 'belarus'); INSERT INTO `geo_countries` VALUES ('', 'Belize', 'BZ', 'BLZ', '84', 'belize'); INSERT INTO `geo_countries` VALUES ('', 'Canada', 'CA', 'CAN', '124', 'canada'); INSERT INTO `geo_countries` VALUES ('', 'Democratic Republic of the Congo', 'CD', 'COD', '180', 'democratic-republic-of-congo'); INSERT INTO `geo_countries` VALUES ('', 'Central African Republic', 'CF', 'CAF', '140', 'central-african-republic'); INSERT INTO `geo_countries` VALUES ('', 'Congo', 'CG', 'COG', '178', 'congo'); INSERT INTO `geo_countries` VALUES ('', 'Switzerland', 'CH', 'CHE', '756', 'switzerland'); INSERT INTO `geo_countries` VALUES ('', 'Cote d\'Ivoire', 'CI', 'CIV', '384', 'cote-divoire'); INSERT INTO `geo_countries` VALUES ('', 'Cook Islands', 'CK', 'COK', '184', 'cook-islands'); INSERT INTO `geo_countries` VALUES ('', 'Chile', 'CL', 'CHL', '152', 'chile'); INSERT INTO `geo_countries` VALUES ('', 'Cameroon', 'CM', 'CMR', '120', 'cameroon'); INSERT INTO `geo_countries` VALUES ('', 'China', 'CN', 'CHN', '156', 'china'); INSERT INTO `geo_countries` VALUES ('', 'Colombia', 'CO', 'COL', '170', 'colombia'); INSERT INTO `geo_countries` VALUES ('', 'Costa Rica', 'CR', 'CRI', '188', 'costa-rica'); INSERT INTO `geo_countries` VALUES ('', 'Cuba', 'CU', 'CUB', '192', 'cuba'); INSERT INTO `geo_countries` VALUES ('', 'Cape Verde', 'CV', 'CPV', '132', 'cape-verde'); INSERT INTO `geo_countries` VALUES ('', 'Cyprus', 'CY', 'CYP', '196', 'cyprus'); INSERT INTO `geo_countries` VALUES ('', 'Czech Republic', 'CZ', 'CZE', '203', 'czech-republic'); INSERT INTO `geo_countries` VALUES ('', 'Germany', 'DE', 'DEU', '276', 'germany'); INSERT INTO `geo_countries` VALUES ('', 'Djibouti', 'DJ', 'DJI', '262', 'djibouti'); INSERT INTO `geo_countries` VALUES ('', 'Denmark', 'DK', 'DNK', '208', 'denmark'); INSERT INTO `geo_countries` VALUES ('', 'Dominica', 'DM', 'DMA', '212', 'dominica'); INSERT INTO `geo_countries` VALUES ('', 'Dominican Republic', 'DO', 'DOM', '214', 'dominican-republic'); INSERT INTO `geo_countries` VALUES ('', 'Algeria', 'DZ', 'DZA', '12', 'algeria'); INSERT INTO `geo_countries` VALUES ('', 'Ecuador', 'EC', 'ECU', '218', 'ecuador'); INSERT INTO `geo_countries` VALUES ('', 'Estonia', 'EE', 'EST', '233', 'estonia'); INSERT INTO `geo_countries` VALUES ('', 'Egypt', 'EG', 'EGY', '818', 'egypt'); INSERT INTO `geo_countries` VALUES ('', 'Western Sahara', 'EH', 'ESH', '732', 'western-sahara'); INSERT INTO `geo_countries` VALUES ('', 'Eritrea', 'ER', 'ERI', '232', 'eritrea'); INSERT INTO `geo_countries` VALUES ('', 'Spain', 'ES', 'ESP', '724', 'spain'); INSERT INTO `geo_countries` VALUES ('', 'Ethiopia', 'ET', 'ETH', '231', 'ethiopia'); INSERT INTO `geo_countries` VALUES ('', 'Finland', 'FI', 'FIN', '246', 'finland'); INSERT INTO `geo_countries` VALUES ('', 'Fiji', 'FJ', 'FJI', '242', 'fiji'); INSERT INTO `geo_countries` VALUES ('', 'Falkland Islands', 'FK', 'FLK', '238', 'falkland-islands'); INSERT INTO `geo_countries` VALUES ('', 'Micronesia', 'FM', 'FSM', '583', 'micronesia'); INSERT INTO `geo_countries` VALUES ('', 'Faeroe Islands', 'FO', 'FRO', '234', 'faeroe-islands'); INSERT INTO `geo_countries` VALUES ('', 'France', 'FR', 'FRA', '250', 'france'); INSERT INTO `geo_countries` VALUES ('', 'Gabon', 'GA', 'GAB', '266', 'gabon'); INSERT INTO `geo_countries` VALUES ('', 'Grenada', 'GD', 'GRD', '308', 'grenada'); INSERT INTO `geo_countries` VALUES ('', 'Georgia', 'GE', 'GEO', '268', 'georgia'); INSERT INTO `geo_countries` VALUES ('', 'French Guiana', 'GF', 'GUF', '254', 'french-guiana'); INSERT INTO `geo_countries` VALUES ('', 'Guernsey', 'GG', 'GGY', '831', 'guernsey'); INSERT INTO `geo_countries` VALUES ('', 'Ghana', 'GH', 'GHA', '288', 'ghana'); INSERT INTO `geo_countries` VALUES ('', 'Gibraltar', 'GI', 'GIB', '292', 'gibraltar'); INSERT INTO `geo_countries` VALUES ('', 'Greenland', 'GL', 'GRL', '304', 'greenland'); INSERT INTO `geo_countries` VALUES ('', 'Gambia', 'GM', 'GMB', '270', 'gambia'); INSERT INTO `geo_countries` VALUES ('', 'Guinea', 'GN', 'GIN', '324', 'guinea'); INSERT INTO `geo_countries` VALUES ('', 'Guadeloupe', 'GP', 'GLP', '312', 'guadeloupe'); INSERT INTO `geo_countries` VALUES ('', 'Equatorial Guinea', 'GQ', 'GNQ', '226', 'equatorial-guinea'); INSERT INTO `geo_countries` VALUES ('', 'Greece', 'GR', 'GRC', '300', 'greece'); INSERT INTO `geo_countries` VALUES ('', 'Guatemala', 'GT', 'GTM', '320', 'guatemala'); INSERT INTO `geo_countries` VALUES ('', 'Guam', 'GU', 'GUM', '316', 'guam'); INSERT INTO `geo_countries` VALUES ('', 'Guinea-Bissau', 'GW', 'GNB', '624', 'guinea-bissau'); INSERT INTO `geo_countries` VALUES ('', 'Guyana', 'GY', 'GUY', '328', 'guyana'); INSERT INTO `geo_countries` VALUES ('', 'Hong Kong', 'HK', 'HKG', '344', 'hong-kong'); INSERT INTO `geo_countries` VALUES ('', 'Honduras', 'HN', 'HND', '340', 'honduras'); INSERT INTO `geo_countries` VALUES ('', 'Croatia', 'HR', 'HRV', '191', 'croatia'); INSERT INTO `geo_countries` VALUES ('', 'Haiti', 'HT', 'HTI', '332', 'haiti'); INSERT INTO `geo_countries` VALUES ('', 'Hungary', 'HU', 'HUN', '348', 'hungary'); INSERT INTO `geo_countries` VALUES ('', 'Indonesia', 'ID', 'IDN', '360', 'indonesia'); INSERT INTO `geo_countries` VALUES ('', 'Ireland', 'IE', 'IRL', '372', 'ireland'); INSERT INTO `geo_countries` VALUES ('', 'Israel', 'IL', 'ISR', '376', 'israel'); INSERT INTO `geo_countries` VALUES ('', 'Isle of Man', 'IM', 'IMN', '833', 'isle-of-man'); INSERT INTO `geo_countries` VALUES ('', 'India', 'IN', 'IND', '356', 'india'); INSERT INTO `geo_countries` VALUES ('', 'Iraq', 'IQ', 'IRQ', '368', 'iraq'); INSERT INTO `geo_countries` VALUES ('', 'Iran', 'IR', 'IRN', '364', 'iran'); INSERT INTO `geo_countries` VALUES ('', 'Iceland', 'IS', 'ISL', '352', 'iceland'); INSERT INTO `geo_countries` VALUES ('', 'Italy', 'IT', 'ITA', '380', 'italy'); INSERT INTO `geo_countries` VALUES ('', 'Jersey', 'JE', 'JEY', '832', 'jersey'); INSERT INTO `geo_countries` VALUES ('', 'Jamaica', 'JM', 'JAM', '388', 'jamaica'); INSERT INTO `geo_countries` VALUES ('', 'Jordan', 'JO', 'JOR', '400', 'jordan'); INSERT INTO `geo_countries` VALUES ('', 'Japan', 'JP', 'JPN', '392', 'japan'); INSERT INTO `geo_countries` VALUES ('', 'Kenya', 'KE', 'KEN', '404', 'kenya'); INSERT INTO `geo_countries` VALUES ('', 'Kyrgyzstan', 'KG', 'KGZ', '417', 'kyrgyzstan'); INSERT INTO `geo_countries` VALUES ('', 'Cambodia', 'KH', 'KHM', '116', 'cambodia'); INSERT INTO `geo_countries` VALUES ('', 'Kiribati', 'KI', 'KIR', '296', 'kiribati'); INSERT INTO `geo_countries` VALUES ('', 'Comoros', 'KM', 'COM', '174', 'comoros'); INSERT INTO `geo_countries` VALUES ('', 'Saint Kitts and Nevis', 'KN', 'KNA', '659', 'saint-kitts-and-nevis'); INSERT INTO `geo_countries` VALUES ('', 'North Korea', 'KP', 'PRK', '408', 'north-korea'); INSERT INTO `geo_countries` VALUES ('', 'South Korea', 'KR', 'KOR', '410', 'south-korea'); INSERT INTO `geo_countries` VALUES ('', 'Kuwait', 'KW', 'KWT', '414', 'kuwait'); INSERT INTO `geo_countries` VALUES ('', 'Cayman Islands', 'KY', 'CYM', '136', 'cayman-islands'); INSERT INTO `geo_countries` VALUES ('', 'Kazakhstan', 'KZ', 'KAZ', '398', 'kazakhstan'); INSERT INTO `geo_countries` VALUES ('', 'Laos', 'LA', 'LAO', '418', 'laos'); INSERT INTO `geo_countries` VALUES ('', 'Lebanon', 'LB', 'LBN', '422', 'lebanon'); INSERT INTO `geo_countries` VALUES ('', 'Saint Lucia', 'LC', 'LCA', '662', 'saint-lucia'); INSERT INTO `geo_countries` VALUES ('', 'Liechtenstein', 'LI', 'LIE', '438', 'liechtenstein'); INSERT INTO `geo_countries` VALUES ('', 'Sri Lanka', 'LK', 'LKA', '144', 'sri-lanka'); INSERT INTO `geo_countries` VALUES ('', 'Liberia', 'LR', 'LBR', '430', 'liberia'); INSERT INTO `geo_countries` VALUES ('', 'Lesotho', 'LS', 'LSO', '426', 'lesotho'); INSERT INTO `geo_countries` VALUES ('', 'Lithuania', 'LT', 'LTU', '440', 'lithuania'); INSERT INTO `geo_countries` VALUES ('', 'Luxembourg', 'LU', 'LUX', '442', 'luxembourg'); INSERT INTO `geo_countries` VALUES ('', 'Latvia', 'LV', 'LVA', '428', 'latvia'); INSERT INTO `geo_countries` VALUES ('', 'Libyan Arab Jamahiriya', 'LY', 'LBY', '434', 'libyan-arab-jamahiriya'); INSERT INTO `geo_countries` VALUES ('', 'Morocco', 'MA', 'MAR', '504', 'morocco'); INSERT INTO `geo_countries` VALUES ('', 'Monaco', 'MC', 'MCO', '492', 'monaco'); INSERT INTO `geo_countries` VALUES ('', 'Moldova', 'MD', 'MDA', '498', 'moldova'); INSERT INTO `geo_countries` VALUES ('', 'Montenegro', 'ME', 'MNE', '499', 'montenegro'); INSERT INTO `geo_countries` VALUES ('', 'Saint-Martin', 'MF', 'MAF', '663', 'saint-martin'); INSERT INTO `geo_countries` VALUES ('', 'Madagascar', 'MG', 'MDG', '450', 'madagascar'); INSERT INTO `geo_countries` VALUES ('', 'Marshall Islands', 'MH', 'MHL', '584', 'marshall-islands'); INSERT INTO `geo_countries` VALUES ('', 'Macedonia', 'MK', 'MKD', '807', 'macedonia'); INSERT INTO `geo_countries` VALUES ('', 'Mali', 'ML', 'MLI', '466', 'mali'); INSERT INTO `geo_countries` VALUES ('', 'Myanmar', 'MM', 'MMR', '104', 'myanmar'); INSERT INTO `geo_countries` VALUES ('', 'Mongolia', 'MN', 'MNG', '496', 'mongolia'); INSERT INTO `geo_countries` VALUES ('', 'Macao', 'MO', 'MAC', '446', 'macao'); INSERT INTO `geo_countries` VALUES ('', 'Northern Mariana Islands', 'MP', 'MNP', '580', 'northern-mariana-islands'); INSERT INTO `geo_countries` VALUES ('', 'Martinique', 'MQ', 'MTQ', '474', 'martinique'); INSERT INTO `geo_countries` VALUES ('', 'Mauritania', 'MR', 'MRT', '478', 'mauritania'); INSERT INTO `geo_countries` VALUES ('', 'Montserrat', 'MS', 'MSR', '500', 'montserrat'); INSERT INTO `geo_countries` VALUES ('', 'Malta', 'MT', 'MLT', '470', 'malta'); INSERT INTO `geo_countries` VALUES ('', 'Mauritius', 'MU', 'MUS', '480', 'mauritius'); INSERT INTO `geo_countries` VALUES ('', 'Maldives', 'MV', 'MDV', '462', 'maldives'); INSERT INTO `geo_countries` VALUES ('', 'Malawi', 'MW', 'MWI', '454', 'malawi'); INSERT INTO `geo_countries` VALUES ('', 'Mexico', 'MX', 'MEX', '484', 'mexico'); INSERT INTO `geo_countries` VALUES ('', 'Malaysia', 'MY', 'MYS', '458', 'malaysia'); INSERT INTO `geo_countries` VALUES ('', 'Mozambique', 'MZ', 'MOZ', '508', 'mozambique'); INSERT INTO `geo_countries` VALUES ('', 'Namibia', 'NA', 'NAM', '516', 'namibia'); INSERT INTO `geo_countries` VALUES ('', 'New Caledonia', 'NC', 'NCL', '540', 'new-caledonia'); INSERT INTO `geo_countries` VALUES ('', 'Niger', 'NE', 'NER', '562', 'niger'); INSERT INTO `geo_countries` VALUES ('', 'Norfolk Island', 'NF', 'NFK', '574', 'norfolk-island'); INSERT INTO `geo_countries` VALUES ('', 'Nigeria', 'NG', 'NGA', '566', 'nigeria'); INSERT INTO `geo_countries` VALUES ('', 'Nicaragua', 'NI', 'NIC', '558', 'nicaragua'); INSERT INTO `geo_countries` VALUES ('', 'Netherlands', 'NL', 'NLD', '528', 'netherlands'); INSERT INTO `geo_countries` VALUES ('', 'Norway', 'NO', 'NOR', '578', 'norway'); INSERT INTO `geo_countries` VALUES ('', 'Nepal', 'NP', 'NPL', '524', 'nepal'); INSERT INTO `geo_countries` VALUES ('', 'Nauru', 'NR', 'NRU', '520', 'nauru'); INSERT INTO `geo_countries` VALUES ('', 'Niue', 'NU', 'NIU', '570', 'niue'); INSERT INTO `geo_countries` VALUES ('', 'New Zealand', 'NZ', 'NZL', '554', 'new-zealand'); INSERT INTO `geo_countries` VALUES ('', 'Oman', 'OM', 'OMN', '512', 'oman'); INSERT INTO `geo_countries` VALUES ('', 'Panama', 'PA', 'PAN', '591', 'panama'); INSERT INTO `geo_countries` VALUES ('', 'Peru', 'PE', 'PER', '604', 'peru'); INSERT INTO `geo_countries` VALUES ('', 'French Polynesia', 'PF', 'PYF', '258', 'french-polynesia'); INSERT INTO `geo_countries` VALUES ('', 'Papua New Guinea', 'PG', 'PNG', '598', 'papua-new-guinea'); INSERT INTO `geo_countries` VALUES ('', 'Philippines', 'PH', 'PHL', '608', 'philippines'); INSERT INTO `geo_countries` VALUES ('', 'Pakistan', 'PK', 'PAK', '586', 'pakistan'); INSERT INTO `geo_countries` VALUES ('', 'Poland', 'PL', 'POL', '616', 'poland'); INSERT INTO `geo_countries` VALUES ('', 'Saint Pierre and Miquelon', 'PM', 'SPM', '666', 'saint-pierre-and-miquelon'); INSERT INTO `geo_countries` VALUES ('', 'Pitcairn', 'PN', 'PCN', '612', 'pitcairn'); INSERT INTO `geo_countries` VALUES ('', 'Puerto Rico', 'PR', 'PRI', '630', 'puerto-rico'); INSERT INTO `geo_countries` VALUES ('', 'Palestine', 'PS', 'PSE', '275', 'palestine'); INSERT INTO `geo_countries` VALUES ('', 'Portugal', 'PT', 'PRT', '620', 'portugal'); INSERT INTO `geo_countries` VALUES ('', 'Palau', 'PW', 'PLW', '585', 'palau'); INSERT INTO `geo_countries` VALUES ('', 'Paraguay', 'PY', 'PRY', '600', 'paraguay'); INSERT INTO `geo_countries` VALUES ('', 'Qatar', 'QA', 'QAT', '634', 'qatar'); INSERT INTO `geo_countries` VALUES ('', 'Reunion', 'RE', 'REU', '638', 'reunion'); INSERT INTO `geo_countries` VALUES ('', 'Romania', 'RO', 'ROU', '642', 'romania'); INSERT INTO `geo_countries` VALUES ('', 'Serbia', 'RS', 'SRB', '688', 'serbia'); INSERT INTO `geo_countries` VALUES ('', 'Russian Federation', 'RU', 'RUS', '643', 'russian-federation'); INSERT INTO `geo_countries` VALUES ('', 'Rwanda', 'RW', 'RWA', '646', 'rwanda'); INSERT INTO `geo_countries` VALUES ('', 'Saudi Arabia', 'SA', 'SAU', '682', 'saudi-arabia'); INSERT INTO `geo_countries` VALUES ('', 'Solomon Islands', 'SB', 'SLB', '90', 'solomon-islands'); INSERT INTO `geo_countries` VALUES ('', 'Seychelles', 'SC', 'SYC', '690', 'seychelles'); INSERT INTO `geo_countries` VALUES ('', 'Sudan', 'SD', 'SDN', '729', 'sudan'); INSERT INTO `geo_countries` VALUES ('', 'Sweden', 'SE', 'SWE', '752', 'sweden'); INSERT INTO `geo_countries` VALUES ('', 'Singapore', 'SG', 'SGP', '702', 'singapore'); INSERT INTO `geo_countries` VALUES ('', 'Saint Helena', 'SH', 'SHN', '654', 'saint-helena'); INSERT INTO `geo_countries` VALUES ('', 'Slovenia', 'SI', 'SVN', '705', 'slovenia'); INSERT INTO `geo_countries` VALUES ('', 'Svalbard and Jan Mayen Islands', 'SJ', 'SJM', '744', 'svalbard-and-jan-mayen-islands'); INSERT INTO `geo_countries` VALUES ('', 'Slovakia', 'SK', 'SVK', '703', 'slovakia'); INSERT INTO `geo_countries` VALUES ('', 'Sierra Leone', 'SL', 'SLE', '694', 'sierra-leone'); INSERT INTO `geo_countries` VALUES ('', 'San Marino', 'SM', 'SMR', '674', 'san-marino'); INSERT INTO `geo_countries` VALUES ('', 'Senegal', 'SN', 'SEN', '686', 'senegal'); INSERT INTO `geo_countries` VALUES ('', 'Somalia', 'SO', 'SOM', '706', 'somalia'); INSERT INTO `geo_countries` VALUES ('', 'Suriname', 'SR', 'SUR', '740', 'suriname'); INSERT INTO `geo_countries` VALUES ('', 'South Sudan', 'SS', 'SSD', '728', 'south-sudan'); INSERT INTO `geo_countries` VALUES ('', 'Sao Tome and Principe', 'ST', 'STP', '678', 'sao-tome-and-principe'); INSERT INTO `geo_countries` VALUES ('', 'El Salvador', 'SV', 'SLV', '222', 'el-salvador'); INSERT INTO `geo_countries` VALUES ('', 'Syrian Arab Republic', 'SY', 'SYR', '760', 'syrian-arab-republic'); INSERT INTO `geo_countries` VALUES ('', 'Swaziland', 'SZ', 'SWZ', '748', 'swaziland'); INSERT INTO `geo_countries` VALUES ('', 'Turks and Caicos Islands', 'TC', 'TCA', '796', 'turks-and-caicos-islands'); INSERT INTO `geo_countries` VALUES ('', 'Chad', 'TD', 'TCD', '148', 'chad'); INSERT INTO `geo_countries` VALUES ('', 'Togo', 'TG', 'TGO', '768', 'togo'); INSERT INTO `geo_countries` VALUES ('', 'Thailand', 'TH', 'THA', '764', 'thailand'); INSERT INTO `geo_countries` VALUES ('', 'Tajikistan', 'TJ', 'TJK', '762', 'tajikistan'); INSERT INTO `geo_countries` VALUES ('', 'Tokelau', 'TK', 'TKL', '772', 'tokelau'); INSERT INTO `geo_countries` VALUES ('', 'Turkmenistan', 'TM', 'TKM', '795', 'turkmenistan'); INSERT INTO `geo_countries` VALUES ('', 'Tunisia', 'TN', 'TUN', '788', 'tunisia'); INSERT INTO `geo_countries` VALUES ('', 'Tonga', 'TO', 'TON', '776', 'tonga'); INSERT INTO `geo_countries` VALUES ('', 'Timor-Leste', 'TP', 'TLS', '626', 'timor-leste'); INSERT INTO `geo_countries` VALUES ('', 'Turkey', 'TR', 'TUR', '792', 'turkey'); INSERT INTO `geo_countries` VALUES ('', 'Trinidad and Tobago', 'TT', 'TTO', '780', 'trinidad-and-tobago'); INSERT INTO `geo_countries` VALUES ('', 'Tuvalu', 'TV', 'TUV', '798', 'tuvalu'); INSERT INTO `geo_countries` VALUES ('', 'Tanzania', 'TZ', 'TZA', '834', 'tanzania'); INSERT INTO `geo_countries` VALUES ('', 'Ukraine', 'UA', 'UKR', '804', 'ukraine'); INSERT INTO `geo_countries` VALUES ('', 'Uganda', 'UG', 'UGA', '800', 'uganda'); INSERT INTO `geo_countries` VALUES ('', 'United Kingdom', 'UK', 'GBR', '826', 'united-kingdom'); INSERT INTO `geo_countries` VALUES ('', 'United States', 'US', 'USA', '840', 'united-states'); INSERT INTO `geo_countries` VALUES ('', 'Uruguay', 'UY', 'URY', '858', 'uruguay'); INSERT INTO `geo_countries` VALUES ('', 'Uzbekistan', 'UZ', 'UZB', '860', 'uzbekistan'); INSERT INTO `geo_countries` VALUES ('', 'Holy See', 'VA', 'VAT', '336', 'holy-see'); INSERT INTO `geo_countries` VALUES ('', 'Saint Vincent and the Grenadines', 'VC', 'VCT', '670', 'saint-vincent-and-grenadines'); INSERT INTO `geo_countries` VALUES ('', 'Venezuela', 'VE', 'VEN', '862', 'venezuela'); INSERT INTO `geo_countries` VALUES ('', 'British Virgin Islands', 'VG', 'VGB', '92', 'british-virgin-islands'); INSERT INTO `geo_countries` VALUES ('', 'U.S. Virgin Islands', 'VI', 'VIR', '850', 'us-virgin-islands'); INSERT INTO `geo_countries` VALUES ('', 'Viet Nam', 'VN', 'VNM', '704', 'viet-nam'); INSERT INTO `geo_countries` VALUES ('', 'Vanuatu', 'VU', 'VUT', '548', 'vanuatu'); INSERT INTO `geo_countries` VALUES ('', 'Wallis and Futuna Islands', 'WF', 'WLF', '876', 'wallis-and-futuna-islands'); INSERT INTO `geo_countries` VALUES ('', 'Samoa', 'WS', 'WSM', '882', 'samoa'); INSERT INTO `geo_countries` VALUES ('', 'Yemen', 'YE', 'YEM', '887', 'yemen'); INSERT INTO `geo_countries` VALUES ('', 'Mayotte', 'YT', 'MYT', '175', 'mayotte'); INSERT INTO `geo_countries` VALUES ('', 'South Africa', 'ZA', 'ZAF', '710', 'south-africa'); INSERT INTO `geo_countries` VALUES ('', 'Zambia', 'ZM', 'ZMB', '894', 'zambia'); INSERT INTO `geo_countries` VALUES ('', 'Zimbabwe', 'ZW', 'ZWE', '716', 'zimbabwe');
使用php读出数据为数组格式,利用json_encode($array_of_countries); 转存为.js 格式或者.json格式供js调用。
二、第二个语言很眼熟有没有!
打开谷歌浏览器->设置高级选项->语言->添加
出现如图:
出现下面这个选项:
按键盘上的F12,根据下面图示操作
点击复制元素,得到数据。
现在有种方案,一种是直接利用你复制到的html元素,添加到你要添加的地方,一种是修改修改,存到数据库,像国家表一样转存为json格式的js文件。
说说第二种思路,这里我提一下编辑器,sublime text3 有它的帮忙,更方便。
把刚才的数据 ctrl+v 到一个php 文件
如图:
在一行显示,很失望?
选中 </option>我们在其后加入一个 回车,为什么选择 </option> 因为在文件中唯一。
选中一个后,我们 ctrl+D, 一直操作结束到不能选择为止,按 “右方向键”+回车,获得如图
同理操作,选择 (<option value=) 以及 (</option>) 还有 (空格+hidden="") 删除掉, 选择括号内的内容:
把 (<select id="add-language-overlay-language-list" aria-labelledby="add-language-overlay-language-list-label">) 删除以及(</select>)删除
得到如图:
同理操作 "> 选中,但不删除,全部选中:
按”右方向键“,按后退键删除 > , 输入 => ", 然后 按 End 键,光标移到末尾, 添加 另一半的 (",) 引号和英文半角逗号。
如图:
用数组包围起来,这样一个数组就构造好了。
然后新建数据表,构造sql语句,插入数据库,就OK了,这些部分就略掉了。
如果有谁需要这个文件的,可以留下QQ,我晚上看到会回复的,别忘了如果有帮助,帮忙顶下呗。
----“做每天该做的事,不计结果!”
---- 因爲對於編程還只是新手,對很多知識掌握的不牢靠,歡迎大家批評指正~~|=-=|~~