0

我正在使用 php_serial_class 和 php 发送短信,代码如下:

但是收到的短信以空行开头,第二行以“>”符号开头,例如:

"

'>Rel1 锁"

(符号 ' 必须删除才能在本网站正确理解)

include "php_serial.class.php";

$serial = new phpSerial;
$serial->deviceSet("/dev/ttyS2");
$serial->confBaudRate(9600);

// Then we need to open it
$serial->deviceOpen();

$serial->sendMessage("ATZ\n\r");
// Wait and read from the port
//$read = $serial -> readPort();

$serial->sendMessage("ATE0\n\r");
// Wait and read from the port
//$read = $serial -> readPort();

// To write into
$serial->sendMessage("AT+cmgf=1;+cnmi=2,1,0,1,0\n\r");//
$serial->sendMessage("AT+cmgs=\"+7912_____\"\n\r");
$serial->sendMessage("Rel1 lock\n\r");
$serial->sendMessage(chr(26));

//wait for modem to send message
sleep(7);
$read=$serial->readPort();

$serial->deviceClose();
4

0 回答 0