1. 程式人生 > >php與js相互調用

php與js相互調用

document asc text tex script content test echo -type

2019-2-3

php與js相互調用
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script type="text/javascript">
function test() {
var t1=3;
t1 = t1+2;
alert(t1);
return t1;
}
</script>

<?php
$name=‘Jet li‘;
// echo "<script type=‘text/javascript‘>test();</script>";
?>

<script>
document.write("welcome!"+"<?php echo $name ?>");
alert("welcome!"+"<?php echo $name ?>");
</script>

php與js相互調用