다음 문자열을 여러 객체로 평가하려면 어떻게해야합니까? 지금은 처음에는 나머지를 무시하고, PHP는 무시합니다. PHP를 통해 생성되므로, jQuery 플러그인의 옵션으로 사용할 수 있도록 평가해야합니다.여러 객체가있는 문자열에서 eval 사용
{
latLng:['.$result->lat.','.$result->lon.'],
options:
{
shadow:
{
url: "'.BASE_URL.'css/png/markerBg.png",
scaledSize:
{
width:40,
height:43.5
}
},
icon:
{
url: "'.$result->user->profileImage.'",
scaledSize:
{
width:32,
height:32
},
anchor:
{
x: 16,
y: 40
}
}
}
},
{
latLng:['.$result->lat.','.$result->lon.'],
options:
{
shadow:
{
url: "'.BASE_URL.'css/png/markerBg.png",
scaledSize:
{
width:40,
height:43.5
}
},
icon:
{
url: "'.$result->user->profileImage.'",
scaledSize:
{
width:32,
height:32
},
anchor:
{
x: 16,
y: 40
}
}
}
},
{
latLng:['.$result->lat.','.$result->lon.'],
options:
{
shadow:
{
url: "'.BASE_URL.'css/png/markerBg.png",
scaledSize:
{
width:40,
height:43.5
}
},
icon:
{
url: "'.$result->user->profileImage.'",
scaledSize:
{
width:32,
height:32
},
anchor:
{
x: 16,
y: 40
}
}
}
}
문자열을 [] 안에 넣을 수 있습니다. 결과는 객체의 배열이어야합니다. – david
Eval을 사용해야하는 경우 문제가 있음을 압니다. –