twilio - 在 Twilio Body 中发送多个 php 字符串
问题描述
朋友们,我正在尝试从帖子中传递一些字符串,例如 $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
ETC... ???
有什么建议么?
解决方案
Twilio 开发人员布道者在这里。
有几种方法可以用这样的多个变量构建字符串。
'body' => $message . $name . $phone
虽然这会将所有字符串推到一起,所以如果$message
是“hello”、$name
是“Phil”和$phone
是“+012345”,它会输出为“helloPhil+012345”。您可以在连接中添加空格来克服它:
'body' => $message . " " . $name . " " . $phone
或者,您可以将变量插入到 string中,如下所示:
'body' => "${message} ${name} ${phone}"
推荐阅读
- python - 无法在浏览器中打开网站网址
- r - 比较 tibble 中的嵌套行并仅检索唯一行
- azure-data-factory-2 - 如何在从开发人员移动到生产环境时在 Azure 数据工厂中动态更改管道级别的默认参数值
- android - 从 api 获取数据时未显示响应
- python - 使用 python 进行二进制读取会产生意想不到的结果
- shopify - ShopifyAPI::RecurringApplicationCharge api 的 403 禁止问题
- kate - 删除 Kate 中的尾随空格
- python - 如何使用另一个日期时间索引获取具有日期时间索引的 Pandas 数据框中的行?
- python - 如何计算组合的百分比?
- python - 我可以手动将输入神经元插入 Keras 的隐藏层吗?