kyubotics / coolq-http-api

为 酷Q 提供通过 HTTP 或 WebSocket 接收事件和调用 API 的能力
https://cqhttp.cc/docs/
GNU General Public License v3.0
1.85k stars 308 forks source link

关于换行 #20

Closed Karensen closed 7 years ago

Karensen commented 7 years ago

利用大佬的接口写了个php脚本,但是发现换行好像没办法处理啊,请问大佬这是什么原因呢?

stdrc commented 7 years ago

有可能是因为你在发送的时候,参数没有进行 urlencode?

Karensen commented 7 years ago

哪个的参数啊? cq码的?

stdrc commented 7 years ago

调用 https://richardchien.github.io/coolq-http-api/#/API 这里的每个接口的时候,都要对 GET 或 POST 的参数/表单做 urlencode,或者以 JSON 形式发送

Karensen commented 7 years ago

大佬的意思是要以json格式发送到监听的端口么??

stdrc commented 7 years ago

我是比较建议用 JSON 的,因为不容易出现莫名其妙的问题,另外不是很了解 PHP,不过估计你发的这样直接拼接字符串应该是不会自动 urlencode 的

stdrc commented 7 years ago

你看下这个函数 http://php.net/manual/en/function.urlencode.php 在拼接之前用这个函数处理一下字符串看看

Karensen commented 7 years ago

php也有jsonencode函数的,我开始一直都是用大佬例子里发的那个链接访问发信息的方法

Karensen commented 7 years ago

希望大佬能够加入获取群成员信息或者好友信息的功能啊

stdrc commented 7 years ago

获取群成员和好友信息我也想写的,不过那个酷 Q 里面没有官方实现,我现在的代码基础上实现起来有点麻烦,如果以后有空的话,会考虑做一下

stdrc commented 7 years ago

php也有jsonencode函数的,我开始一直都是用大佬例子里发的那个链接访问发信息的方法

你可以先试试 '&message=' . urlencode($message); 这样,一般主要就是要 urlencode 一下 message

Karensen commented 7 years ago

果然可以了,感谢大佬指点ORZ

stdrc commented 7 years ago

不客气(另外,我也不是大佬 ==