我正在尝试通过 twilio 的 Record 动词操作 url 传递数据。当有两个或多个查询字符串参数时,它会失败,但当只有一个时,它会成功。
成功:
var response = '<Response><Say>STUFF TO SAY</Say><Pause length="1"/><Record maxLength="3600" timeout="30" action="/service/training/call/recording?test1=test&test2=test"></Record></Response>';
失败:
var response = '<Response><Say>STUFF TO SAY</Say><Pause length="1"/><Record maxLength="3600" timeout="30" action="/service/training/call/recording?test1=test"></Record></Response>';
错误:
Error on line 1 of document : The reference to entity "test2" must end with the ';' delimiter.
有没有办法可以通过查询字符串传递数据,或者我是否必须使用 url 参数? “/service/training/call/recording/test/test
最佳答案
Twilio 支持人员回复了我。这是他们的回应。
修复方法是将代码中的“&”替换为有效的 XML 替换项“&”。所以你的 TwiML 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>STUFF TO SAY</Say>
<Pause length="1"/>
<Record maxLength="3600" timeout="30" action="/service/training/call/recording?test1=test&test2=test">
</Record>
</Response>
关于node.js - twilio 操作 url 中的查询参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42938601/