如果行数恰好为 0,我想保存 sessionStorage 项目,我知道我不应该在标题之前回显任何内容,因此,请让我知道在这种情况下标题之前设置 sessionStorage 的最佳方法是什么。只有js和php,不想用jquery。提前致谢 !
<?php
$admin_table = "admin_table";
$show_all_admins = "SELECT * FROM $admin_table";
$show_all_admins_query = mysqli_query($conn, $show_all_admins);
$rowcount = mysqli_num_rows($show_all_admins_query);
if($rowcount == 0 ){
mysqli_close($conn);
echo'<script>sessionStorage.setItem("admin_sessn", "admins");</script>';
header('Location: http://localhost/littlesidegym.php');
exit();
}
?>