我想使用TextMagic服务发送短信到保存在数据库中的手机,我尝试了不同的方法,但不起作用。
$y = mysql_query(" SELECT * FROM customer WHERE account_num = '$a' ");
if (mysql_num_rows($y) > 0) {
$row1 = mysql_fetch_array($y);
$a1 = $row1['phone_num'];
$api = new TextMagicAPI(array(
"username" => "***",
"password" => "***"
));
$phone = array('$a1');
$text = "hello ";
$results = $api->send($text, $phone, true);
}我怎样才能解决这个问题?
发布于 2015-10-18 05:28:31
我不确定这是否是问题所在,但是:(假设$a1 = 999)
$phone = array('$a1'); // array(1) { [0]=> string(3) "$a1" } 不同于
$phone = array("$a1"); // array(1) { [0]=> string(3) "999" } 并且不同于
$phone = array($a1); // array(1) { [0]=> int(999) }根据this,看起来第三个选项是正确的。
https://stackoverflow.com/questions/33190255
复制相似问题