Php 为sms脚本添加变量
我使用一个类来实现sms等,但它不会100%触发,因为我似乎无法从其他php页面获得变量。 我需要在if语句中添加更多的变量,以便sms消息可以对用户输入的状态和类型等唯一, 下面是基本代码,我希望能得到一些帮助Php 为sms脚本添加变量,php,Php,我使用一个类来实现sms等,但它不会100%触发,因为我似乎无法从其他php页面获得变量。 我需要在if语句中添加更多的变量,以便sms消息可以对用户输入的状态和类型等唯一, 下面是基本代码,我希望能得到一些帮助 $acc_id = $upd->getField('account_id'); $status = $upd->getField('status'); $meetingtype = $upd->getField(''); error_lo
$acc_id = $upd->getField('account_id');
$status = $upd->getField('status');
$meetingtype = $upd->getField('');
error_log($status);
//show me how to add account name? accounts.name
$acc_id = $upd->getField('account_id');
$acc = new Account();
$acc->retrieve($acc_id);
$acc->primary_phone;
error_log($acc->name);
$sms = new DawproSms();
$sms->number = $acc->primary_phone;
$themeetingtype = $upd->getField('');
$theStatus = $upd->getField('status');
if ($theStatus == 'Held')
{
$sms->message = "Your Moovah removal is confirmed for <date><time>@ <location>. Should you have any questions, kindly contact SA Taxi on 0861 88 99 88.";
$sms->number = '0123456789';
$return = $sms->send();
if ($return){
error_log('SMS Sent!');
} else {
error_log('There was a problem sending the SMS');
}
}
else if ($theStatus == 'Held')
{
$sms->message = "Your SA Taxi Media removal is confirmed for <date><time>@ <location>. Should you have any questions, kindly contact SA Taxi on 0861 88 99 88.";
$sms->number = '0123456789';
$return = $sms->send();
if ($return){
error_log('SMS Sent!');
} else {
error_log('There was a problem sending the SMS');
}
}
else if ($theStatus == 'Held')
{
$sms->message = "Your SA Taxi Media and Moovah removal is confirmed for <date><time>@ <location>. Should you have any questions, kindly contact SA Taxi on 0861 88 99 88.";
$sms->number = '0123456789';
$return = $sms->send();
if ($return){
error_log('SMS Sent!');
} else {
error_log('There was a problem sending the SMS');
}
}
else if ($theStatus == 'Accepted')
{
$sms->message = "Your Moovah branding replacement is confirmed for <date><time>@ <location>. Questions? Contact SA Taxi on 0861 88 99 88.";
$sms->number = '0123456789';
$return = $sms->send();
if ($return){
error_log('SMS Sent!');
} else {
error_log('There was a problem sending the SMS');
}
}
$acc_id=$upd->getField('account_id');
$status=$upd->getField('status');
$meetingtype=$upd->getField(“”);
错误日志($status);
//演示如何添加帐户名?accounts.name
$acc_id=$upd->getField('account_id');
$acc=新账户();
$acc->retrieve($acc\u id);
$acc->primary_电话;
错误日志($acc->name);
$sms=new DawproSms();
$sms->number=$acc->primary_phone;
$themeetingtype=$upd->getField(“”);
$theStatus=$upd->getField('status');
如果($theStatus=='Hold')
{
$sms->message=“您的Moovah移除已确认@。如果您有任何问题,请致电0861 88 99 88联系SA出租车。”;
$sms->number='0123456789';
$return=$sms->send();
如果($返回){
错误日志('SMS已发送!');
}否则{
错误日志(“发送SMS时出现问题”);
}
}
否则如果($theStatus=='hold')
{
$sms->message=“您的SA出租车媒体删除已确认@。如有任何问题,请致电0861 88 99 88联系SA出租车。”;
$sms->number='0123456789';
$return=$sms->send();
如果($返回){
错误日志('SMS已发送!');
}否则{
错误日志(“发送SMS时出现问题”);
}
}
否则如果($theStatus=='hold')
{
$sms->message=“您的SA出租车媒体和Moovah删除已确认@。如果您有任何问题,请致电0861 88 99 88联系SA出租车。”;
$sms->number='0123456789';
$return=$sms->send();
如果($返回){
错误日志('SMS已发送!');
}否则{
错误日志(“发送SMS时出现问题”);
}
}
else if($theStatus==‘已接受’)
{
$sms->message=“您的Moovah品牌替换已确认@。有问题吗?请致电0861 88 99 88联系SA出租车。”;
$sms->number='0123456789';
$return=$sms->send();
如果($返回){
错误日志('SMS已发送!');
}否则{
错误日志(“发送SMS时出现问题”);
}
}
根据我从你的问题中了解到的情况,你想在IF语句中使用多个条件吗?如果是这样,您可以这样做:
if($theStatus == 'Held' && $status== 'Mover'){
//code
}
switch($theStatus){
case "Held":
//sms code thing
break;
case "Accepted":
//Sms code thing
break
}
但是,如果您只想对一个字段/变量进行验证,也可以这样做:
if($theStatus == 'Held' && $status== 'Mover'){
//code
}
switch($theStatus){
case "Held":
//sms code thing
break;
case "Accepted":
//Sms code thing
break
}
您可以在此处看到交换机的更详细描述:那么,您在这里遇到了什么问题?我在这里没有看到任何问题。你的问题有点让人困惑,因为你的两个If语句底部的“$theStatus”实际上是一样的。我试图让它在一个状态和另一个变量上触发,例如在另一个模块/页面中的特定产品字段值-在SugarCRM系统上开发