如何在脚本标签中使用php函数?

时间:2019-11-20 22:48:30

标签: javascript php sql database insert

 <script>
 function onProgress(currentTime) {
    if(currentTime > 20) {
      console.log("the video reached 20 seconds!");
      <?php
        include("ayar.php");
        $mysqli = connection();
        $email = $_POST['email'];
        $hak = '1';
        $sorgu = mysqli_query($mysqli,"INSERT INTO gift_chance(email,hak) values ('$email', '$hak')");
      ?>
    }
  }
  </script>

这种用法有可能吗?如果currentTime大于给定的秒数,我想执行php代码。

0 个答案:

没有答案