I have this code:
$lat = $obj['geo']['coordinates'][0];
$long = $obj['geo']['coordinates'][1];
Its to do with google maps. So these two variables take the coordinate values (lat and long) from a mongodb. Assume this works.
And I have this in the javascript:
var loc = <?php echo json_encode($lat, $long); ?>;
I'm attempting here to make these two php arrays into a 2d javascript array, but it's not working.
Any help is greatly appreciated!
Try this:
var loc = <?php echo json_encode(array($lat, $long)); ?>;
If it's not that what you need, just tell it, i have some more ideas ;-)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.