我知道我可能会投很多票,但请在我快到了的时候帮助我完成这个。我有以下代码。
<?php
exec("mode COM1 BAUD=9600 PARITY=N data=8 stop=1 xon=off");
$fp = fopen ("\\.\com1", "r+");
//$fp = dio_open('COM5:', O_RDWR | O_NOCTTY | O_NONBLOCK);
if (!$fp)
{
echo "Uh-oh. Port not opened.";
}
else
{
$string = "AT+CMGF=1";
$string = $string."OK";
$string = $string."AT+CMGS='+44XXXXX'";
$string = $string."> Hello World?<Ctrl>+<Z>";
$string = $string."+CMGS: 44";
$string = $string."OK";
fputs ($fp, $string );
echo $string."\n";
fclose ($fp);
}
?>
上面的代码正在输出AT+CMGF=1OKAT+CMGS='+44XXXX'> Hello World?++CMGS: 44OK
,但实际上并未向该号码发送任何消息。
我的设备与装有 SIM 卡的 PC 相连。
我怎样才能做到这一点?