将 PHP 值传递给 AGI
Passing PHP value to AGI
我还是 PHP 和星号的新手。我正在尝试将值从 HTML 文本输入传递到 php 页面,该页面与星号通信以通过 GSM 调制解调器发送短信文本。到目前为止,这是我试验过的代码。
$num = $_POST['cNum'];
$msg = $_POST['cMessage'];
$type='gsm';
$method='send';
$sync='sync sms';
$span='4';
$destination=$num;
$message=$msg;
$timeout='20';
$id='1234';
$agi->Command("$type $method $sync $span $destination $message $timeout $id");
exit(0);
这确实有效,但问题是例如我要在文本输入 "cMessage" 中输入 "Sample Space",我将收到的短信只会是 "Sample"(没有双引号)。第一个 space 字符之后的所有单词都将被省略。但是,如果我尝试以这种方式编码:
$num = $_POST['cNum'];
$msg = $_POST['cMessage'];
$type='gsm';
$method='send';
$sync='sync sms';
$span='4';
$destination=$num;
$message='"Sample Space"'; <----------- for example
$timeout='20';
$id='1234';
$agi->Command("$type $method $sync $span $destination $message $timeout $id");
exit(0);
我可以收到整条消息"Sample Space"(没有双引号)
有人可以帮我解决这个问题吗?
接缝就像你在学习时错过了报价php。
尝试使用它
$message='\"Sample Space\"'; <----------- for example
我还是 PHP 和星号的新手。我正在尝试将值从 HTML 文本输入传递到 php 页面,该页面与星号通信以通过 GSM 调制解调器发送短信文本。到目前为止,这是我试验过的代码。
$num = $_POST['cNum'];
$msg = $_POST['cMessage'];
$type='gsm';
$method='send';
$sync='sync sms';
$span='4';
$destination=$num;
$message=$msg;
$timeout='20';
$id='1234';
$agi->Command("$type $method $sync $span $destination $message $timeout $id");
exit(0);
这确实有效,但问题是例如我要在文本输入 "cMessage" 中输入 "Sample Space",我将收到的短信只会是 "Sample"(没有双引号)。第一个 space 字符之后的所有单词都将被省略。但是,如果我尝试以这种方式编码:
$num = $_POST['cNum'];
$msg = $_POST['cMessage'];
$type='gsm';
$method='send';
$sync='sync sms';
$span='4';
$destination=$num;
$message='"Sample Space"'; <----------- for example
$timeout='20';
$id='1234';
$agi->Command("$type $method $sync $span $destination $message $timeout $id");
exit(0);
我可以收到整条消息"Sample Space"(没有双引号) 有人可以帮我解决这个问题吗?
接缝就像你在学习时错过了报价php。
尝试使用它
$message='\"Sample Space\"'; <----------- for example