我有这段代码可以向您的手机发送短信...
$text = fopen("../data/textmembers/registry.txt","r") or die("couldent open file");
while (!feof($text)) {
$name = fgets($text);
$number = fgets($text);
$carrier = fgets($text);
$date = fgets($text);
$line = fgets($text);
$content = $_POST['message'];
$message .= $content;
$message .= "\n";
$number = trim($number);
mail($number . "@vtext.com", "SGA Event Alert", $message, "SGA");
Header("Location: mailconf.php");
一切正常......如果你看看我所拥有的“@ vtext.com”,这是我的问题 你可能知道或不知道,每个运营商都有自己的扩展,verizon是@ vtext.com,而且是@txt.att.net。我需要从“$ carrier”获取Feed确定它是什么载体,然后为其分配扩展名... 我认为ifelse会起作用,但我对if语句不满意...... 用户的选择是
Verizon = 1234567890@vtext.com AT& T = 1234567890@txt.att.net T-mobile = @ tmomail.net Nextel = @ messaging.nextel.com
谢谢你们!
答案 0 :(得分:1)
$carriers = array(
"verizon" => "vtext.com",
"at&t" => "txt.att.net",
"t-mobile" => "tmomail.net",
"nextel" => "messaging.nextel.com"
);
然后,通过查找键获得该值:
print $carriers[strtolower($carrier)];
如果$carrier
是“Nextel”,则会返回“messaging.nextel.com”。
答案 1 :(得分:0)