我需要自动完成文字输入城市名单和相应的时区 [英] I need a list of cities and the corresponding timezone for an autocomplete text input
问题描述
我在哪里可以找到城市/时区的数据来填充我的自动完成文字输入。
Where can i find city/timezone data to populate my autocomplete text input.
文本输入将被用于输入一个城市,那么在幕后,我将使用赶到城里时区...
The text input will be used to type in a city, then behind the scenes i will use the city to get the time zone...
我想preFER到应用程序中持有它本身和实时明白这一点。
I would prefer to hold it within the app itself and not get it in realtime.
这将是一个iPhone应用程序。
This will be for an iphone app.
谢谢,
M
推荐答案
如果您需要此信息的任何城市/地球上的城市,你需要使用一个web服务;有这样的无列表。看看这个职位的一些建议: Web服务 - 对于当前时区城市?
If you need this information for any city/town on earth, you'll need to use a webservice; there's no list of that as such. Look at this post for some recommendations: Web service - current time zone for a city?
我看不到上面提到的CSV,但是,如果你是一个时区,并在区域内的一些相关城市后,PHP拥有的 DateTimeZone类
I can't see the csv mentioned above, but, if you were after a time zone and a few relevant cities inside the zone, PHP has a DateTimeZone class
这将返回所有标识符是这样的:
that will return all identifiers like this:
$data = DateTimeZone::listIdentifiers();
这篇关于我需要自动完成文字输入城市名单和相应的时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!