我有一个 PHP 代码,它的功能是阻止 IP 地址。
include ("includes/_db_.php");
$query_ip = mysql_query("SELECT * FROM t_ip_address");
while ($data_ip = mysql_fetch_array($query_ip))
{
$valid_ips = $data_ip['ip_address'];
if (!in_array($_SERVER['REMOTE_ADDR'],$valid_ips))
{
echo '<div class="denied"><img src="images/stop.png"/><span class="titles">Access Denied</span><br><span class="content">Sorry you do not have authorized to access this page.</span></div>
<div class="footer"><a href="../">Back to previous page</a></div>
';
exit();
}
}
但是现在面临问题,错误是:警告:in_array()期望参数2是数组,字符串给出...
有人有建议吗?