在Twilio正文中发送多个php字符串

在Twilio正文中发送多个php字符串,twilio,Twilio,朋友们,我正在尝试从帖子中传递一些字符串,例如$name$phonenumber等 $client = new Client($account_sid, $auth_token); $client->messages->create( // Where to send a text message (your cell phone?) '+16477458535', array( 'from' => $twilio_number, 'body' => $message )

朋友们,我正在尝试从帖子中传递一些字符串,例如$name$phonenumber等

$client = new Client($account_sid, $auth_token);
$client->messages->create(
// Where to send a text message (your cell phone?)
'+16477458535',
array(
'from' => $twilio_number,
'body' => $message
)
但似乎不能像这样连接:

'body' => $message, $name, phone
等等。。。


有什么建议吗?

这里是Twilio开发者福音传道者

有两种方法可以用这样的多个变量构建字符串

例如,您可以使用:

“body”=>$message$名字$电话
虽然这会将所有字符串推到一起,因此如果
$message
是“hello”,那么
$name
是“Phil”,而
$phone
是“+012345”,则会显示为“helloPhil+012345”。您可以在连接中添加空格以克服此问题:

“body”=>$message。" " . $名称" " . $电话
或者,您可以这样做:

'body'=>“${message}${name}${phone}”