如何从 CMS 将我的网页设置为维护模式?
我正在制作我的第一个网页,但无法解决一个问题。我正在进行 CMS 维护设置。我想选择(下拉)将索引从index.php更改为maintenance.php。
我的网站如下所示:
/cms/index.phpmaintenance.php
重命名为index.php
如果我将maintenance.php
,CMS仍然可以工作(我留下了登录区域供管理员进入)。
所以,我的问题是:这是切换到维护模式最合乎逻辑的方式吗?如果是,那么如何?或者也许有更有效的方法?
I'm working on my first web page and I can't solve one problem. I'm making CMS maintenance settings. I want to make option (drop down) to change index from index.php to maintenance.php.
My site looks like this:
/cms/
index.php
maintenance.php
If I rename maintenance.php to index.php, CMS still works (I left log in area for admin to get in).
So, my question: is this most logical way switch to maintenance mode? If yes, then how? Or maybe there is more efficient way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建一个用于打开和关闭维护模式的表单字段(数据库中的零或一)。然后您可以在您的index.php
html
标记之前查询该行。如果维护模式行返回 1,则将用户转发到maintenance.php 页面。或者,您可以在 index.php 页面中使用 if/else 语句执行所有这些操作:
Create a form field that toggles maintenance mode on and off (a zero or a one in the database). Then you can query that row before your your index.php
html
tag. if the maintenance mode row returns a 1, forward the user to the maintenance.php page.Alternatively, you could do all of this in the index.php page with and if/else statement:
为什么不将“维护模式”符号链接“maintenance.php”到“index.php”?当您关闭它时,删除符号链接并使“index.php”指向“realindex.php”
Why not make 'maintenance mode' symlink 'maintenance.php' to 'index.php'? When you turn it off, delete the symlink and make 'index.php' point to 'realindex.php'