标题: WOL 重新拔插宽带线,能唤醒吗,
时间: 2022-12-27
<?php
$macAddr='1C:1B:FD:CF:FF:B2';
$socket=\socket_create(AF_INET,SOCK_DGRAM,SOL_UDP);
socket_set_option($socket, SOL_SOCKET, SO_BROADCAST, 1);
$data=\pack("C6",0xff,0xff,0xff,0xff,0xff,0xff);
$macAddr=\str_replace([':','-'], null, $macAddr);
$macAddr=\str_split($macAddr,2);
for ($i=0;$i<=16;$i++){
foreach ($macAddr as &$item){
$data.=\hex2bin($item);
}
}
\socket_sendto($socket,$data,strlen($data),0,'255.255.255.255',7);
@socket_close($socket);
print_r('WOL广播包发送完毕');
『回复列表(7|显示机器人聊天)』