发布网友 发布时间:2022-04-06 02:02
共1个回答
热心网友 时间:2022-04-06 03:32
试编写脚本如下:
<?php
header('Content-type:text/html;charset=utf-8');
$s = "---== 21262502301, '中心东路', 8 nods, 10 nodes =>
1: 0,(-2639.848633,-2544.598145; 268,0,1; -1,-1) 21262460312,21262402701 4,-1
>1, 7.666504
>3942, 32.685303
>8744, 14.188477
>9265, 0.0869";
$pa = "{'([^`])+'}";
preg_match_all($pa, $s, $r);
$place = str_replace("'",'',$r[0][0]);
$pa = '{\(([\-?0-9]+\.[0-9]+),([\-?0-9]+\.[0-9]+);}';
preg_match_all($pa, $s, $r);
$x = $r[1][0];
$y = $r[2][0];
echo "地名:$place<br />坐标:$x, $y";
?>追问---== 21262502301, '中心东路', 8 nods, 10 nodes =>
。。。
---== 21262342301, '中心西路', 4 nods, 6 nodes =>
。。。
只有一条路就没问题,如果路多了,比如上面是两条了,请您给个循环输出的写法吧!
追答
1: 0,(-2639.848633,-2544.598145; 268,0,1; -1,-1) 21262460312,21262402701 4,-1
>1, 7.666504
>3942, 32.685303
>8744, 14.188477
>9265, 0.0869
2: 1,(-27.349609,-2544.432617; 265,0,1; -1,-1) 21262402701,21262402701 2,-1
>0, 7.666504
>2, 14.395996
>-1, -107374176.000000
>-1, -107374176.000000";
$pa = "{'([^`])+'}";
preg_match_all($pa, $s, $r);
$place = str_replace("'",'',$r[0][0]);
$pa = '{([\-?0-9]+\.[0-9]+),([\-?0-9]+\.[0-9]+)}';
preg_match_all($pa, $s, $r, PREG_SET_ORDER);
echo "地名:$place";
for($i=0;$i";
}
?>