This repository has been archived on 2026-06-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2025-01-14 01:21:42 +08:00

54 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# API 调用工具
## 项目概述
这是一个用于批量调用API并实时显示调用结果的PHP工具。使用SSEServer-Sent Events)技术实现实时进度更新和结果展示。
## 配置说明
1. 修改 `config.php` 文件:
-`$links` 数组中添加或修改需要调用的API地址
- 示例:
```php
$links = [
'https://api.example.com/endpoint1',
'https://api.example.com/endpoint2'
];
```
## 使用说明
1. 将项目部署到支持PHP的Web服务器
2. 访问 `index.php`
3. 点击"执行 API 调用"按钮
4. 页面将显示:
- 实时进度条
- 每个API调用的详细信息:
- 调用链接
- 开始时间
- 结束时间
- 执行时间
- 返回结果
## 修改说明
1. 修改API调用超时时间:
- 打开 `index.php`
- 修改以下参数:
```php
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); // 连接超时时间(秒)
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // 执行超时时间(秒)
```
2. 修改SSE心跳间隔:
- 打开 `index.php`
- 查找 `setInterval` 函数
- 修改5000为期望的间隔时间(毫秒)
3. 修改重试次数:
- 打开 `index.php`
- 查找 `maxReconnectAttempts` 变量
- 修改值为期望的重试次数
## 注意事项
1. 确保服务器支持SSE
2. 确保PHP版本 >= 5.3
3. 如果使用Nginx,请确保配置了正确的缓冲设置
4. 生产环境建议启用SSL验证