字体 / 数据库 / 其他内容 版权归原作者所有,仅为引用
- MySQL
- PHP 8+
- 首先你需要进行一个环境的装
- 其次你需要导入根目录的 SQL
- 然后你需要修改数据配置
- 运行
composer install
安装所需包 - 记得找一个大冤种图床或者自己建一个,否则会一直占用空间
- 看下面
请求内容:
GET HTTP/1.1 https://example/path-to-handle?config=History
理想的返回值:
{
"ID": "9889",
"Type": "History",
"Value": "https://public-img.mycdn.sgguo.com/2022/09/25/21/1664096215-633017d73fcf3.png",
"Question": "请输入上图事件发生日期",
"Note": "格式例如:11451400,公元前请加 '-'表示",
"Answer": "8ebe69b8410442e39a3e3cc899608c09"
}
JavaScript 于客户端的实现:
// 使用前请进行实例化,传 baseURL:string,在使用时直接使用此方法:实例化变量.getVerification('History'); 或其他配置,注意返回值为 Fetch 构造的 Promise
class Verification {
baseURL: string;
constructor(baseURL: string) {
this.baseURL = baseURL;
}
public getVerification(config: string): any {
return fetch(`${this.baseURL}/?config=${config}`, {
method: "GET",
mode: "cors", // no-cors, *cors, same-origin
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
credentials: "same-origin", // include, *same-origin, omit
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
redirect: "follow", // manual, *follow, error
});
}
}
const getVerificationCode = new Verification("https://example");
getVerificationCode
.getVerification("History")
.then((res: any) => {
res.json().then((data: any) => {
// Your Code
});
})
.catch((err: any) => {
// 你的错误处理机制
});
本项目有极大的可拓展性,返回结果就是个 Array,所以不止于 API 和 客户端的实现,你也可以不使用云服务方案,在本地 caches 文件夹进行本地操作,操作细节可以自己看代码
'Question' => '请输入上图物质的分子式'
Powered by SDT & Gong_cx.