如何使用Twilio PHP库将谓词嵌套在GARGET语句中?

如何使用Twilio PHP库将谓词嵌套在GARGET语句中?,php,twilio,Php,Twilio,我有一个简单的调用应用程序,我正在使用Twilio构建。我没有使用静态twiml,而是使用Twilio的PHP库提供的服务twiml类构建动态twiml 我可以很好地处理简单的事情,但是,我一辈子都不知道如何在php库的gather语句中嵌套say/play动词 以下是我所拥有的: $this->gather(array ("action" => "http://pbx.somedomain.com/twilio/inbound/step/mainmenu_ivr")); (when

我有一个简单的调用应用程序,我正在使用Twilio构建。我没有使用静态twiml,而是使用Twilio的PHP库提供的服务twiml类构建动态twiml

我可以很好地处理简单的事情,但是,我一辈子都不知道如何在php库的gather语句中嵌套say/play动词

以下是我所拥有的:

$this->gather(array ("action" => "http://pbx.somedomain.com/twilio/inbound/step/mainmenu_ivr")); (when keypad entry occurs it hits the action url)
我需要使用传入数组复制twiml行为:

<gather action="http://pbx.somedomain.com/twilio/inbound/step/mainmenu_ivr">
    <say>Please enter your extension.</say>
</gather>

请输入您的分机号码。
如何构造传递给gather函数的数组,以将say嵌套在gather语句中

提前感谢。

试试这个:

require('/path/to/twilio-php/Services/Twilio.php');
$response = new Services_Twilio_Twiml();
$gather = $response->gather(array('action' => 'http://pbx.example.com'));
$gather->say('Please enter your extension');
print $response;
本页上列出了更多示例