如何在下面的代码中将JavaScript值分配给$pag_num
。我希望$page_num
等于JavaScript变量页面而不使用ajax。有什么方法可以将php变量直接等同于JavaScript变量?
<script>
var page = 2;
<script>
<?php
$sql = mysqli_query($con, "SELECT * FROM papers WHERE category = '$cat'
LIMIT $page_num, 2 ");
?>