如何在同一 php 文件中的 php 代码之后 运行 javascript 代码?
How to run javascript code after php code in the same php file?
我有一个简单的问题。在我的用户登录后,我想显示一个弹出窗口。这里的问题是 php 代码在 javascript 代码之前运行。有没有办法在我重定向后显示我的弹出窗口?
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
</head>
<?php
session_start();
session_destroy();
header("Location: Login.html");
echo '<script>swal("Oops..", "Because of inactivity, you where logged off", "info")</script>';
?>
header("Location: login.html?popup=true");
文件登录:
if(isset($_GET['popup'])){
回声'swal("Oops..", "Because of inactivity, you where logged off", "info")';
}
我有一个简单的问题。在我的用户登录后,我想显示一个弹出窗口。这里的问题是 php 代码在 javascript 代码之前运行。有没有办法在我重定向后显示我的弹出窗口?
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
</head>
<?php
session_start();
session_destroy();
header("Location: Login.html");
echo '<script>swal("Oops..", "Because of inactivity, you where logged off", "info")</script>';
?>
header("Location: login.html?popup=true");
文件登录:
if(isset($_GET['popup'])){ 回声'swal("Oops..", "Because of inactivity, you where logged off", "info")'; }