이 형식의 문자열이 있습니다.
"1784_Anarchy + Brew + Co ~ Unit + 5 + Whitehouse + Farm + Centre ~ Stannington ~ Morpeth ~ NE61 + 6AW_ ^ 55.13033 ~ -1.702607"
패턴이 다음과 같이 보일까요
preg_match_all("\^d+\", $map, $out, PREG_PATTERN_ORDER);
그래서 위도-\ ^ d + .d +? lng-\ ~ d + .d +?
위도 및 경도 값 얻기-위도 : 55.13033 lng : -1.702607
lat 및 lng 문자열 위치가 일정하게 유지되는 경우 빠른 방법이 있습니다. 그렇지 않으면 다른 인스턴스를 게시
$str = '1784_Anarchy+Brew+Co~Unit+5+Whitehouse+Farm+Centre~Stannington~Morpeth~NE61+6AW_^55.13033~-1.702607';
preg_match_all("/(?<=[\^|\~])\-?([\d\.]+)/", $str, $matches);
$lat = $matches[0][0];
$lng = $matches[0][1];
echo "lat: $lat, Lng: $lng";
//output: lat: 55.13033, Lng: -1.702607
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다