wordpress数据连接出错时,会有一个空白页面,有一行字:数据连接错误。这样当然不美观,好在这个页面是可以自定义的。
/wp-content/目录下创建'db-error.php'文件,当数据库出现错误时,系统会自动使用这个页面。

<?php // custom WordPress database error page

  header('HTTP/1.1 503 Service Temporarily Unavailable');
  header('Status: 503 Service Temporarily Unavailable');
  header('Retry-After: 600'); // 1 hour = 3600 seconds

  // If you wish to email yourself upon an error
  // mail("your@email.com", "Database Error", "There is a problem with the database!", "From: Db Error Watching");

?>

<!DOCTYPE HTML>
<html>
<head>
<title>Database Error</title>
<style>
body { padding: 20px; background: red; color: white; font-size: 60px; }
</style>
</head>
<body>
  You got problems.
</body>
</html>

相关文章:

  • 2021-11-22
  • 2021-06-19
  • 2021-10-10
  • 2021-11-07
  • 2021-05-28
  • 2022-01-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2021-11-17
  • 2021-09-18
  • 2022-02-04
相关资源
相似解决方案