【发布时间】:2021-07-20 01:16:46
【问题描述】:
我在向其他 php 文件发送消息并显示带有甜蜜警报的成功通知消息时遇到 1 个问题。最初,程序希望通过 url 发送消息到其他 php 文件(index.php)并运行 index.php 中的 php 代码(如果在 login function.php 中没有发现错误的页面).Login function php是所有用于检查 login.php 的功能。 index.php 是用户成功登录系统的地方。
在 login function.php 我有这段代码
header("Location: " .$path."/order/index.php?page=1&login_status=success");
在 index.php 的底部,我在下面包含了 php 代码。
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<?php
if(isset($_GET['login_status']) && $_GET['login_status'] == 'success'){
echo "<script>
Swal.fire({
icon: 'success',
title: 'Welcome to MyCommerse',
})
</script>";
echo "<script>
history.replaceState(null, '', location.href.split('&')[0]);
</script>";
}
?>
当我在 Visual Studio 代码中使用 PHP Debug 运行调试时,程序停在 header("Location: " .$path."/order/index.php?page=1&login_status=success");强>。它不运行 index.php 中的编码。
【问题讨论】:
-
你的
$path是什么?
标签: php post get sweetalert