I want to pass JavaScript variables to PHP variables.
var a=0 to $a
<script>
var a=0;
</script>
<?php
$a = 0;
?>
因为 JS 在客户端(浏览器)上运行而 PHP 在服务器上运行,所以 JS 无法直接与 PHP 对话,除非您通过 FORM 提交或 AJAX(您的 PHP 可以在将其发送到浏览器之前直接写出到 JS,但反之亦然)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.