How to call the php function in js, js passes in the variable, and the php function returns it to the js variable after processing. I can't read what I wrote. , error report,. It's OK to apply script to PHP, but it won't work if you apply script to PHP. . Specifically, I want to know how to directly transfer variables
<script> var a="1001"; var op='666'; od="<?php $b=op; echo jia($b) ; a variable: '.$b; function jia($c){ //$c="<script>document.write(op)</script>"; return $c.'---8888'; } ?>
<script>
var a='1001';
var op='666';
od="<?php $bb=' 888'; $b='<script>document.write(op)</script>'; echo jia($b);
##</script><?php '; echo 'a variable:'.$b; function jia($c){ return $c.'---8888'; }?> I mainly want to get the js variables in js and return them after execution in php. . .If you want to pass a value, you can use session
As I told you, the PHP code is executed first
The op variable is not defined in PHP
Parse PHP first, then parse JS