我有一个数组 { $address = array(..........);
} 我已将其转换为 {
foreach ($address as $key => $val){
$points[] = "['{$val}', '{$val}']";
}
$output = join ("," , $points);
$req_format = strip_tags($output);
}
输出:['30 South Wacker Drive Floor 22 Chicago IL 60606', '30 South Wacker Drive Floor 22 Chicago IL 60606'],['288 Bishopsgate London, EC2M 4QP United Kingdom', '288 Bishopsgate London, EC2M 4QP United Kingdom '],['麦迪逊大道 260 号 8 楼纽约 NY 10016 ', '麦迪逊大道 260 号 8 楼纽约 NY 10016 ']
我需要将此值分配给 js 变量:
var locationsArray = [
['30 South Wacker Drive Floor 22 Chicago IL 60606', '30 South Wacker Drive Floor 22 Chicago IL 60606'],
['30 South Wacker Drive Floor 22 Chicago IL 60606', '30 South Wacker Drive Floor 22 Chicago IL 60606']
];
如何分配 php 变量 $req_format 等于 js 变量 locationArray = [??????];