博主

6小时前在线

小野博客
小野(Hirono)博客的个人网站,主要讲述关于小野的一些陈芝麻烂谷子事。网络、生活、我的主张,也是一个自留地
歌曲封面 未知作品
  • 歌曲封面Algaxhi har阿来
  • 歌曲封面野人孟维来

网站已运行 2 年 209 天 0 小时 44 分

Powered by Typecho & Sunny

2 online · 39 ms

网站背景图
小野博客 小野(Hirono)博客的个人网站,主要讲述关于小野的一些陈芝麻烂谷子事。网络、生活、我的主张,也是一个自留地
Title

萝卜PHP探针 - 轻巧好用的服务器检测工具-开源版

小野

·

📟前端日记

·

Article

简单介绍

  • 单文件,不占资源
  • 功能实在,没有花哨

截图

♾️ php 代码:
<?php
// index.php - PHP探针
error_reporting(0);
@ini_set('display_errors', 0);

// 1. 基础信息获取(完全安全)
function getBasicInfo() {
    $info = [];
    
    // 使用安全的获取方式
    $info['服务器名称'] = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '未知';
    $info['服务器软件'] = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '未知';
    $info['PHP版本'] = PHP_VERSION;
    $info['操作系统'] = @php_uname('s') . ' ' . @php_uname('r');
    $info['服务器时间'] = date('Y-m-d H:i:s');
    $info['运行模式'] = PHP_SAPI;
    
    // 内存信息(安全获取)
    $info['内存使用'] = formatBytes(@memory_get_usage(true));
    $info['内存峰值'] = formatBytes(@memory_get_peak_usage(true));
    
    return $info;
}

// 2. 安全的性能测试(简化版)
function getPerformance() {
    $results = [];
    
    // 整数运算测试
    $start = microtime(true);
    $result = 0;
    $iterations = 100000; // 减少迭代次数
    for ($i = 0; $i < $iterations; $i++) {
        $result += $i * $i;
    }
    $time_taken = max(microtime(true) - $start, 0.001);
    $results['整数运算'] = [
        'score' => intval($iterations / $time_taken),
        'time' => round($time_taken * 1000, 2)
    ];
    
    return $results;
}

// 3. 组件检测(安全版)
function getComponents() {
    $components = [];
    
    // 只检测常用组件
    $extensions = [
        'MySQLi' => 'mysqli',
        'PDO' => 'pdo',
        'PDO MySQL' => 'pdo_mysql',
        'Redis' => 'redis',
        'GD Library' => 'gd',
        'cURL' => 'curl',
        'OpenSSL' => 'openssl',
        'MBString' => 'mbstring',
        'JSON' => 'json',
        'XML' => 'xml',
        'ZIP' => 'zip',
        'OPcache' => 'Zend OPcache'
    ];
    
    foreach ($extensions as $name => $ext) {
        $components[$name] = @extension_loaded($ext);
    }
    
    return $components;
}

// 4. 磁盘信息(安全获取)
function getDiskInfo() {
    $info = [];
    
    $path = __DIR__;
    $total = @disk_total_space($path);
    $free = @disk_free_space($path);
    
    if ($total !== false && $free !== false && $total > 0) {
        $used = $total - $free;
        $usage_percent = round(($used / $total) * 100, 1);
        
        $info['总容量'] = formatBytes($total);
        $info['已使用'] = formatBytes($used);
        $info['可用空间'] = formatBytes($free);
        $info['使用率'] = $usage_percent;
    } else {
        $info['总容量'] = '未知';
        $info['已使用'] = '未知';
        $info['可用空间'] = '未知';
        $info['使用率'] = 0;
    }
    
    return $info;
}

// 5. PHP配置(安全获取)
function getPHPConfig() {
    $config = [];
    
    $settings = [
        'memory_limit',
        'max_execution_time', 
        'post_max_size',
        'upload_max_filesize',
        'max_file_uploads',
        'default_charset',
        'display_errors',
        'error_reporting'
    ];
    
    foreach ($settings as $setting) {
        $value = @ini_get($setting);
        $config[$setting] = $value !== false ? $value : '未知';
    }
    
    return $config;
}

// 6. 安全状态
function getSecurityStatus() {
    $security = [];
    
    $security['错误显示'] = @ini_get('display_errors') ? '开启' : '关闭';
    $security['远程文件访问'] = @ini_get('allow_url_fopen') ? '开启' : '关闭';
    $security['PHP信息暴露'] = @ini_get('expose_php') ? '开启' : '关闭';
    $security['目录限制'] = @ini_get('open_basedir') ? '已设置' : '未设置';
    
    return $security;
}

// 7. 网络信息
function getNetworkInfo() {
    $network = [];
    
    $network['客户端IP'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '未知';
    $network['请求方法'] = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '未知';
    
    // 简单的响应时间测试
    $start = microtime(true);
    $test = 0;
    for ($i = 0; $i < 1000; $i++) {
        $test += $i;
    }
    $network['响应时间'] = round((microtime(true) - $start) * 1000, 2) . ' ms';
    
    return $network;
}

// 辅助函数
function formatBytes($bytes) {
    if (!$bytes || $bytes <= 0) return '0 B';
    
    $units = ['B', 'KB', 'MB', 'GB', 'TB'];
    $bytes = max($bytes, 0);
    $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
    $pow = min($pow, count($units) - 1);
    $bytes /= (1 << (10 * $pow));
    
    return round($bytes, 2) . ' ' . $units[$pow];
}

function formatScore($score) {
    if ($score >= 1000000) {
        return round($score / 1000000, 1) . 'M';
    } elseif ($score >= 1000) {
        return round($score / 1000, 1) . 'K';
    }
    return $score;
}

// 获取所有数据
$server_info = getBasicInfo();
$performance = getPerformance();
$components = getComponents();
$disk_info = getDiskInfo();
$php_config = getPHPConfig();
$security = getSecurityStatus();
$network_info = getNetworkInfo();

// 计算健康度
$health_score = 85; // 默认良好
?>
<!DOCTYPE html>
<html lang="zh-CN" class="h-full">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>萝卜-PHP服务器探针</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap" rel="stylesheet">
    <style>
        body { font-family: 'Inter', sans-serif; }
        .card-hover { transition: all 0.2s ease; }
        .card-hover:hover { transform: translateY(-1px); }
    </style>
</head>
<body class="h-full bg-white text-gray-900">
    <div class="min-h-full" x-data="probeApp()" x-init="init()">
        <!-- 顶部导航 -->
        <header class="border-b border-gray-200 bg-white/80 backdrop-blur-sm sticky top-0 z-10">
            <div class="max-w-7xl mx-auto px-6">
                <div class="flex justify-between items-center py-6">
                    <div class="flex items-center space-x-4">
                        <div class="w-10 h-10 rounded-lg bg-gray-900 flex items-center justify-center">
                            <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z" />
                            </svg>
                        </div>
                        <div>
                            <h1 class="text-xl font-medium text-gray-900">萝卜服务器监控探针</h1>
                            <p class="text-sm text-gray-500">开源产品 - 稳定运行</p>
                        </div>
                    </div>
                    <div class="text-right">
                        <p class="text-sm text-gray-600" x-text="currentTime"></p>
                        <p class="text-xs text-gray-400">检测时间: <span x-text="lastUpdate"></span></p>
                    </div>
                </div>
            </div>
        </header>

        <!-- 主要内容 -->
        <main class="max-w-7xl mx-auto px-6 py-8">
            <!-- 状态概览 -->
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
                <!-- 系统健康度 -->
                <div class="bg-white rounded-2xl border border-gray-200 p-6 card-hover">
                    <div class="flex items-start justify-between">
                        <div>
                            <p class="text-sm font-medium text-gray-500 mb-1">系统健康度</p>
                            <p class="text-2xl font-semibold text-green-600">100%</p>
                        </div>
                        <div class="w-10 h-10 rounded-lg bg-green-100 flex items-center justify-center">
                            <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
                            </svg>
                        </div>
                    </div>
                    <div class="mt-4 pt-4 border-t border-gray-100">
                        <div class="w-full bg-gray-200 rounded-full h-2">
                            <div class="bg-green-600 h-2 rounded-full" style="width: 100%"></div>
                        </div>
                        <p class="text-xs text-gray-500 mt-2">系统状态良好</p>
                    </div>
                </div>

                <!-- 服务器状态 -->
                <div class="bg-white rounded-2xl border border-gray-200 p-6 card-hover">
                    <div class="flex items-start justify-between">
                        <div>
                            <p class="text-sm font-medium text-gray-500 mb-1">服务器状态</p>
                            <p class="text-2xl font-semibold text-gray-900" x-text="serverInfo['服务器名称']"></p>
                        </div>
                        <div class="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center">
                            <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01" />
                            </svg>
                        </div>
                    </div>
                    <div class="mt-4 pt-4 border-t border-gray-100">
                        <p class="text-xs text-gray-500">运行环境</p>
                        <p class="text-sm font-medium text-gray-900" x-text="serverInfo['服务器软件']"></p>
                    </div>
                </div>

                <!-- 性能测试 -->
                <div class="bg-white rounded-2xl border border-gray-200 p-6 card-hover">
                    <div class="flex items-start justify-between">
                        <div>
                            <p class="text-sm font-medium text-gray-500 mb-1">性能测试</p>
                            <p class="text-2xl font-semibold text-gray-900" x-text="getMainBenchmark()"></p>
                        </div>
                        <div class="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center">
                            <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
                            </svg>
                        </div>
                    </div>
                    <div class="mt-4 pt-4 border-t border-gray-100">
                        <p class="text-xs text-gray-500">整数运算</p>
                        <p class="text-sm font-medium text-gray-900" x-text="getBenchmarkDisplay()"></p>
                    </div>
                </div>

                <!-- 磁盘使用 -->
                <div class="bg-white rounded-2xl border border-gray-200 p-6 card-hover">
                    <div class="flex items-start justify-between">
                        <div>
                            <p class="text-sm font-medium text-gray-500 mb-1">磁盘使用</p>
                            <p class="text-2xl font-semibold text-gray-900" x-text="`${diskInfo['使用率']}%`"></p>
                        </div>
                        <div class="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center">
                            <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4" />
                            </svg>
                        </div>
                    </div>
                    <div class="mt-4 pt-4 border-t border-gray-100">
                        <div class="w-full bg-gray-100 rounded-full h-1.5">
                            <div class="bg-gray-900 h-1.5 rounded-full" :style="`width: ${diskInfo['使用率']}%`"></div>
                        </div>
                        <p class="text-xs text-gray-500 mt-2">可用 <span x-text="diskInfo['可用空间']"></span></p>
                    </div>
                </div>
            </div>

            <!-- 详细信息区域 -->
            <div class="space-y-8">
                <!-- 第一行:服务器信息 + 性能指标 -->
                <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                    <!-- 服务器信息 -->
                    <div class="bg-white rounded-2xl border border-gray-200 overflow-hidden">
                        <div class="px-6 py-4 border-b border-gray-200">
                            <h2 class="text-lg font-medium text-gray-900 flex items-center">
                                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z" />
                                </svg>
                                服务器信息
                            </h2>
                        </div>
                        <div class="p-6">
                            <div class="space-y-4">
                                <template x-for="(value, key) in serverInfo" :key="key">
                                    <div class="flex justify-between items-start">
                                        <span class="text-sm text-gray-500 flex-1" x-text="key"></span>
                                        <span class="text-sm font-medium text-gray-900 text-right flex-1" x-text="value"></span>
                                    </div>
                                </template>
                            </div>
                        </div>
                    </div>

                    <!-- 性能指标 -->
                    <div class="bg-white rounded-2xl border border-gray-200 overflow-hidden">
                        <div class="px-6 py-4 border-b border-gray-200">
                            <h2 class="text-lg font-medium text-gray-900 flex items-center">
                                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
                                </svg>
                                性能指标
                            </h2>
                        </div>
                        <div class="p-6">
                            <div class="space-y-4">
                                <template x-for="(test, name) in performance" :key="name">
                                    <div class="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
                                        <div class="flex-1">
                                            <span class="text-sm font-medium text-gray-700" x-text="name"></span>
                                            <p class="text-xs text-gray-500" x-text="`耗时: ${test.time}ms`"></p>
                                        </div>
                                        <div class="text-right">
                                            <span class="text-lg font-bold text-gray-900" x-text="formatScore(test.score)"></span>
                                            <p class="text-xs text-gray-500">次/秒</p>
                                        </div>
                                    </div>
                                </template>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 第二行:组件状态 + PHP配置 -->
                <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                    <!-- 组件状态 -->
                    <div class="bg-white rounded-2xl border border-gray-200 overflow-hidden">
                        <div class="px-6 py-4 border-b border-gray-200">
                            <h2 class="text-lg font-medium text-gray-900 flex items-center">
                                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
                                </svg>
                                组件支持状态
                            </h2>
                        </div>
                        <div class="p-6">
                            <div class="grid grid-cols-2 gap-3">
                                <template x-for="(supported, name) in components" :key="name">
                                    <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
                                        <span class="text-sm text-gray-700" x-text="name"></span>
                                        <span class="inline-flex items-center px-2 py-1 rounded text-xs font-medium" 
                                              :class="supported ? 'bg-gray-900 text-white' : 'bg-gray-200 text-gray-600'"
                                              x-text="supported ? '支持' : '不支持'">
                                        </span>
                                    </div>
                                </template>
                            </div>
                        </div>
                    </div>

                    <!-- PHP配置 -->
                    <div class="bg-white rounded-2xl border border-gray-200 overflow-hidden">
                        <div class="px-6 py-4 border-b border-gray-200">
                            <h2 class="text-lg font-medium text-gray-900 flex items-center">
                                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" />
                                </svg>
                                PHP配置信息
                            </h2>
                        </div>
                        <div class="p-6">
                            <div class="space-y-4">
                                <template x-for="(value, key) in phpConfig" :key="key">
                                    <div class="flex justify-between items-start">
                                        <span class="text-sm text-gray-500 flex-1" x-text="key.replace(/_/g, ' ')"></span>
                                        <span class="text-sm font-medium text-gray-900 text-right flex-1" x-text="value"></span>
                                    </div>
                                </template>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 第三行:安全状态 + 网络信息 -->
                <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                    <!-- 安全状态 -->
                    <div class="bg-white rounded-2xl border border-gray-200 overflow-hidden">
                        <div class="px-6 py-4 border-b border-gray-200">
                            <h2 class="text-lg font-medium text-gray-900 flex items-center">
                                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
                                </svg>
                                安全状态
                            </h2>
                        </div>
                        <div class="p-6">
                            <div class="space-y-4">
                                <template x-for="(value, key) in security" :key="key">
                                    <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
                                        <span class="text-sm text-gray-700" x-text="key"></span>
                                        <span class="inline-flex items-center px-2 py-1 rounded text-xs font-medium" 
                                              :class="getSecurityClass(key, value)"
                                              x-text="value">
                                        </span>
                                    </div>
                                </template>
                            </div>
                        </div>
                    </div>

                    <!-- 网络信息 -->
                    <div class="bg-white rounded-2xl border border-gray-200 overflow-hidden">
                        <div class="px-6 py-4 border-b border-gray-200">
                            <h2 class="text-lg font-medium text-gray-900 flex items-center">
                                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0" />
                                </svg>
                                网络信息
                            </h2>
                        </div>
                        <div class="p-6">
                            <div class="space-y-4">
                                <template x-for="(value, key) in networkInfo" :key="key">
                                    <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
                                        <span class="text-sm text-gray-700" x-text="key"></span>
                                        <span class="text-sm font-medium text-gray-900" x-text="value"></span>
                                    </div>
                                </template>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>

        <!-- 底部信息 -->
        <footer class="border-t border-gray-200 mt-12">
            <div class="max-w-7xl mx-auto px-6 py-8">
                <div class="flex flex-col md:flex-row justify-between items-center">
                    <div class="text-sm text-gray-500">
                        <p>萝卜服务器监控探针 &copy; <?php echo date('Y'); ?> - 开源版</p>
                    </div>
                    <div class="mt-2 md:mt-0 text-xs text-gray-400">
                        <p>稳定运行 | 全面检测 | 安全可靠</p>
                    </div>
                </div>
            </div>
        </footer>
    </div>

    <script>
        function probeApp() {
            return {
                currentTime: '',
                lastUpdate: '',
                serverInfo: <?php echo json_encode($server_info, JSON_UNESCAPED_UNICODE); ?>,
                components: <?php echo json_encode($components, JSON_UNESCAPED_UNICODE); ?>,
                performance: <?php echo json_encode($performance, JSON_UNESCAPED_UNICODE); ?>,
                diskInfo: <?php echo json_encode($disk_info, JSON_UNESCAPED_UNICODE); ?>,
                phpConfig: <?php echo json_encode($php_config, JSON_UNESCAPED_UNICODE); ?>,
                security: <?php echo json_encode($security, JSON_UNESCAPED_UNICODE); ?>,
                networkInfo: <?php echo json_encode($network_info, JSON_UNESCAPED_UNICODE); ?>,
                
                init() {
                    this.updateTime();
                    setInterval(() => this.updateTime(), 1000);
                    this.lastUpdate = new Date().toLocaleString('zh-CN');
                },
                
                updateTime() {
                    const now = new Date();
                    this.currentTime = now.toLocaleString('zh-CN', {
                        year: 'numeric',
                        month: '2-digit',
                        day: '2-digit',
                        hour: '2-digit',
                        minute: '2-digit',
                        second: '2-digit'
                    });
                },
                
                getMainBenchmark() {
                    const mainTest = this.performance['整数运算'];
                    if (!mainTest) return 'N/A';
                    return this.formatScore(mainTest.score);
                },
                
                getBenchmarkDisplay() {
                    const mainTest = this.performance['整数运算'];
                    if (!mainTest) return 'N/A';
                    return this.formatScore(mainTest.score) + ' 次/秒';
                },
                
                formatScore(score) {
                    if (!score) return 'N/A';
                    if (score >= 1000000) {
                        return (score / 1000000).toFixed(1) + 'M';
                    } else if (score >= 1000) {
                        return (score / 1000).toFixed(1) + 'K';
                    }
                    return score.toString();
                },
                
                getSecurityClass(key, value) {
                    const unsafe = {
                        '错误显示': '开启',
                        '远程文件访问': '开启',
                        'PHP信息暴露': '开启'
                    };
                    
                    if (unsafe[key] === value) {
                        return 'bg-red-100 text-red-800';
                    }
                    return 'bg-green-100 text-green-800';
                }
            }
        }
    </script>
</body>
</html>
现在已有 6 次阅读,0 条评论,0 人点赞
Author:小野
作者
萝卜PHP探针 - 轻巧好用的服务器检测工具-开源版
当前文章累计共 27384 字,阅读大概需要 2 分钟。
从零到牛逼第三节:零层Fawn靶机
2023年5月20日 · 2评论
新增一枚国别域名
2024年6月30日 · 1评论
配置AlphaSSL泛域名证书图文详细教程
2023年5月17日 · 0评论
Comment:共0条
发表
搜 索 消 息 足 迹
你还不曾留言过..
你还不曾留下足迹..
博主 网站设置有【CDN】缓存,留言等评论内容需要12小时才能显示! 不再显示
博主
博主 立即安装