GET
实用工具
表达式计算
计算数学表达式,支持 + - * / % ^ 和括号。
累计调用 50
今日调用 1
更新于 2026-10-16
调用地址
GET
https://itapi.top/api/calc
请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| exp | string | 必填 | 数学表达式 | 暂无 |
| text | string | 可选 | text 参数(代码支持) | 暂无 |
返回字段
| 字段名 | 类型 | 说明 |
|---|---|---|
| code | int | 状态码 |
| data.result | float | 计算结果 |
| data.result_text | string | 结果文本 |
响应示例
200 OK
{"code":200,"msg":"success","data":{"exp":"1+2*3","result":7,"result_text":"7"}}
在线测试
代码示例
cURL · GET
curl "https://itapi.top/api/calc?exp=%E6%9A%82%E6%97%A0&text=%E6%9A%82%E6%97%A0"
PHP
<?php
$res = file_get_contents("https://itapi.top/api/calc?exp=%E6%9A%82%E6%97%A0&text=%E6%9A%82%E6%97%A0");
$json = json_decode($res, true);
print_r($json);
JavaScript
const res = await fetch("https://itapi.top/api/calc?exp=%E6%9A%82%E6%97%A0&text=%E6%9A%82%E6%97%A0");
const json = await res.json();
console.log(json);
Python
import requests
r = requests.get("https://itapi.top/api/calc?exp=%E6%9A%82%E6%97%A0&text=%E6%9A%82%E6%97%A0", timeout=10)
print(r.json())