3

这是一个例子:

$array = "[[51.228697283276,0.45897198252166],[51.228697283276,0.59374016480853],[51.312903819352,0.59374016480853],[51.312903819352,0.45897198252166]]";
4

2 回答 2

8

这看起来像 JSON。您可以使用json_decode()它来解码它:

json_decode($array);
于 2013-08-06T12:18:28.930 回答
1

使用此代码将此字符串转换为数组

    <?php 
$string ="[[51.228697283276,0.45897198252166],[51.228697283276,0.59374016480853],[51.312903819352,0.59374016480853],[51.312903819352,0.45897198252166]]";
$array = explode(',',$string);
for($i=0;$i<count($array);$i++){
    $array[$i] = trim($array[$i],'[[');
    $array[$i] = trim($array[$i],']]');
}
echo '<pre>'; print_r($array); ?>
于 2013-08-06T12:29:03.043 回答