如何把PHP的二维数组赋值给JS变量
展开全部
<春洞羡script>颤闷
a = new array();
<?php
$array = array("a" => array(1,2),
"b"扒拍 => array(3,4)
);
foreach($array as $K=>$V)
{
echo "a[$K] = new array();";
foreach($V as $k=>$v)
{
echo "a[$K][$k] = $v;";
}
}
?>
</script>
a = new array();
<?php
$array = array("a" => array(1,2),
"b"扒拍 => array(3,4)
);
foreach($array as $K=>$V)
{
echo "a[$K] = new array();";
foreach($V as $k=>$v)
{
echo "a[$K][$k] = $v;";
}
}
?>
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询