我有这个 javascript 数组
<script>
$(function() {
var foo= [ "one",
"two",
"three",
"one",
"final"];
</script>
现在,我正在尝试foo
用 PHP 数组替换 。
<?php $array = array("sky","mac","rain","bob","sep","ion"); ?>
现在,我试过了
<script>
$(function() {
var foo= [<?php array("sky","mac","rain","bob","sep","ion"); ?> ];
</script>
但是,它似乎不起作用