gpt4 book ai didi

php - 如何使用 PHP 抓取此内容并仅获取纬度/经度

转载 作者:行者123 更新时间:2023-11-28 15:56:54 26 4
gpt4 key购买 nike

比如说,我有这个代码:

var i = new GIcon(G_DEFAULT_ICON);
var latlng = new GLatLng(33.013489, -117.140167);

map.setCenter(latlng, 9);
map.panTo(latlng);

var i = new GIcon(G_DEFAULT_ICON);
var latlng = new GLatLng(32.979286, -117.02623);

map.setCenter(latlng, 9);
map.panTo(latlng);

var i = new GIcon(G_DEFAULT_ICON);
var latlng = new GLatLng(32.746319, -117.141449);

map.setCenter(latlng, 9);
map.panTo(latlng);

var i = new GIcon(G_DEFAULT_ICON);
var latlng = new GLatLng(32.758286, -117.125053);

map.setCenter(latlng, 9);
map.panTo(latlng);

如何使用 PHP 返回列表或仅返回纬度和经度。所以 GLatLng()

之间的任何内容

所以我最终会得到一个看起来像这样的数组:

32.758286, -117.125053
32.979286, -117.02623
32.746319, -117.141449
32.758286, -117.125053

最佳答案

preg_match_all('~
(?<=\() (?# starts with opening parentheses )
(?P<lat>[\d.-]+) (?# then a digit, dot or dash more than one time )
\s*,\s* (?# followed by a comma with any number of spaces around )
(?P<lng>[\d.-]+) (?# then another digit, dot or dash more than one time )
(?=\)) (?# ends with closing parentheses )
~x', $str, $matches);
var_dump($matches);

关于php - 如何使用 PHP 抓取此内容并仅获取纬度/经度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18391204/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com