php数组转换js数组
var obj = eval(<?php echo json_encode($Row2);?>); console.log(obj) var arr = [] for (let i in obj) { arr.push(obj[i]); }
<!-- PHP 传给js: -->
<?php $jsj='23'; ?> <script> var t= <?php echo $jsj; ?> </script> <script> $("span").click(function () { $("h1").text(t) }) s=1001; a=2002; </script> <!-- js传值给PHP: --> <?php $s= "<script>document.write(s)</script>"; ?> <!-- 不同页面传值 --> <!-- JS传给PHP: --> <script> window.location.href='indexch.php?bb=' + begins + '&ee=' + ends; </script> <!-- 不同页面传值 --> <!-- PHP传给JS: --> <!-- :PHP传给JS还是一样的,在a.php 中的PHP变量先传给b.php -->
<?php $jsj='23';
?>
<script>
var t= <?php echo $jsj; ?>
</script>
<script>
$("span").click(function () {
$("h1").text(t)
})
s=1001; a=2002;
</script>
<!-- js传值给PHP: -->
<?php
$s= "<script>document.write(s)</script>";
?>
<?php echo $s; ?>
<!-- 不同页面传值 -->
<!-- JS传给PHP: -->
<script>
window.location.href='indexch.php?bb=' + begins + '&ee=' + ends;
</script>
<!-- 不同页面传值 -->
<!-- PHP传给JS: -->
<!-- :PHP传给JS还是一样的,在a.php 中的PHP变量先传给b.php -->