Browse Source

找不到表白时自动跳转到404页面

UnknownO 3 năm trước cách đây
mục cha
commit
a951944077
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      pages/card.php

+ 8 - 0
pages/card.php

@@ -39,6 +39,14 @@ try {
     if ($stmt->execute()) {
         $rows = $stmt->fetchAll();
         $row = $rows[0];
+        if (empty($row)) {
+            if ($REWRITE) {
+                $pageNotFound = "/404";
+            } else {
+                $pageNotFound = "/?page=404";
+            }
+            exit("<script> setTimeout(function () { $.pjax({ url: '" . $pageNotFound . "', container: '#pjax-container' }); }, 10) </script>");
+        }
 ?>
         <div class="mdui-card mdui-hoverable" style="border-radius: 16px;">
             <div class="mdui-card-header">