M1开启维护模式并设置允许指定ip访问

4.28K 浏览M1交流区

M1开启维护模式并设置允许指定ip访问

M1里开启维护模式

在项目根目录下:

touch maintenance.flag

允许指定ip访问,

修改index.php

添加

$ip = $_SERVER['REMOTE_ADDR'];
$allowed_ips = array('171.83.45.11','你的电脑ip'); // Change the IPs 1.2.3.4 and 2.3.4.5 to the IP addresses of the developers that should have access while in maintenance mode.
if (file_exists($maintenanceFile) && !in_array ($ip, $allowed_ips)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}

1