首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从CMS将我的网页设置为维护模式?

问如何从CMS将我的网页设置为维护模式?
EN

Stack Overflow用户
提问于 2010-12-17 07:18:21
回答 2查看 542关注 0票数 0

我正在写我的第一个网页,但我一个问题都解决不了。我正在进行CMS维护设置。我想让选项(下拉)将索引从index.php更改为maintenance.php。

我的网站如下所示:

/cms/

index.php

maintenance.php

如果我将maintenance.php重命名为index.php,内容管理系统仍然可以工作(我离开了登录区,让管理员进入)。

那么,我的问题是:这种最合理的方式是切换到维护模式吗?如果是,那是怎么做的?或者也许有更有效的方法?

EN

回答 2

Stack Overflow用户

发布于 2010-12-17 07:25:03

创建一个用于打开和关闭维护模式的表单域(数据库中的0或1)。然后,您可以在您的index.php html标记之前查询该行。如果维护模式行返回1,则将用户转到maintenance.php页面。

代码语言:javascript
复制
<?php
// query your database for the maintenance mode boolean
if($maintenance == '1') header('Location: http://www.example.com/maintenance.php');
?>
<html>

或者,您可以在index.php页面中使用和if/else语句完成所有这些操作:

代码语言:javascript
复制
</head>
<body>
<?php
  // query your database for the maintenance mode boolean
  if($maintenance == '1') include('maintenance.php');
  else{
?>
<div id="homepage">
</div>
<? } // end else ?>
</body>
票数 0
EN

Stack Overflow用户

发布于 2010-12-17 07:26:55

为什么不让“维护模式”符号链接“maintenance.php”到“index.php”呢?当您关闭它时,删除符号链接并使'index.php‘指向'realindex.php’

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4466315

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档