所以我使用Discord.JS来创建一个不一致的机器人,我有一个命令
if(command === "addme") {
//code here
return message.reply(`Added ${message.author} to Database!`);
};
如何让它从向JSON文件添加键和属性的文件中调用PHP函数?
我被困在了从这里开始的地方。我尝试了人们在这个网站上发布的其他问题的解决方案,但我找不到任何解决我的问题的方法。
如果你能帮上忙,谢谢!
发布于 2018-08-01 08:08:00
这取决于你想在哪里调用你的php function
,
从表面上看,如果我没记错的话...看起来您并不想与DiscordJS
的custom PHP function
交互,而是希望与API交互
- Is it on a browser ,iOS or Android? - There are couple of different approaches depending on the choice of environment you are in.
- I assume you are using JS as your back-end , you could use an `HTTP client` like [request](https://github.com/request/request)
简单的代码行,比如
var request = require('request');
request('https://saficloud.com', function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); // Print the HTML for the SafiCloud homepage.
});
就是你需要开始的地方,
干杯:)
https://stackoverflow.com/questions/51623535
复制相似问题