85.124.99.2
如何隐藏IP的最后两个数字?
,使之像:
86.124.xxx.xxx
写得很快
$ip = "85.124.99.2";
$parts = explode('.',$ip);
$new_ip = $parts[0].'.'.$parts[1].'.xxx.xxx';
警告:在访问$parts[n]
$ip = preg_replace('/'.'d+'.'d+$/', '.xxx.xxx', $ip);
使用IP地址,只打印需要的内容。除了在屏幕上打印之外,不确定你所说的"制作"是什么意思
使用此正则表达式
(?!'d{1,3}'.'d{1,3}'.)'d
示例137.133.204.130 -> 137.133.***.***
93.108.72.157 -> 93.108.**.***