修改:config.inc.php
在第一行加入
$ip_prefix = '192.168.121.';
if (substr($_SERVER['REMOTE_ADDR'], 0, strlen($ip_prefix)) != $ip_prefix ) die('illegal access error');
ip可以设置成你自己电脑的ip。如果是内网建议直接设置成自己的ip地址取代ip地址段。这样的话可以防止其它用户在内网中访问。如果是公网ip限制,直接使用即可。
只是简单的限定,没有太大要求只是暂时限定,可以使用这种方式。临时性的限制用户去访问。
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号