Home >Backend Development >PHP Tutorial >How PHP interacts with js data
The content of this article is to share with you how PHP interacts with js data. It has a certain reference value. Friends in need can refer to it
There are two types of PHP and js There are two transmission methods: one is to use URL, and the other is to transmit within an interface.
The method of transferring under the same interface is as follows:
<html> <title></title> <body> <?php $a=1; echo "<script>var b=\"$a\"</script>"; ?> <script language="javascript"> alert(b); </script> </body> </html>
The effect is as follows:
Related recommendations:
Data interaction between PHP and JS
The above is the detailed content of How PHP interacts with js data. For more information, please follow other related articles on the PHP Chinese website!