-1

如何在 $_POST 变量之前和之后插入静态短语?这是我正在使用的代码:

<?php
require_once '/home/example/public_html/sms/vendor/autoload.php';
use Plivo\RestAPI;
$auth_id = "MAM2IXMDVLNZI3xxxxxx";
$auth_token = "YmI0NmQyZWQ5MDcwNjEyNjc4ZTMxYjNhMmxxxxxx";

$p = new RestAPI($auth_id, $auth_token);

// Send a message
$params = array(
        'src' => 'AcmeLLC', // Sender's phone number with country code
        'dst' =>  $_POST["dst"], //Receiver's phone number with country code
        'text' => $_POST["text"], // Your SMS text message
        //'url' => 'http://example.com/sms.html', // The URL to which with the status of the message is sent
        'method' => 'POST' // The method used to call the url
    );
 // Send message
$response = $p->send_message($params);

// Print the response
echo "Response : ";
print_r ($response['response']);

// Print the Api ID
echo "<br> Api ID : {$response['response']['api_id']} <br>";

// Print the Message UUID
echo "Message UUID : {$response['response']['message_uuid'][0]} <br>";

?>

我希望实现这样的目标:

'text' => Hello, $_POST["name"] Thank you for registering. Your unique membership ID is $_POST["memid"] More details have been sent on $_POST["email"]

如您所知,这显然是错误的,因为没有提示表明某些词是否实际上是静态的,而其他词是否是通过 POST 从重力形式接收的。我该怎么办?

谢谢!

4

1 回答 1

1

干得好:

'text' => 'Hello'.$_POST["name"].'Thank you for registering. Your unique membership ID is'. $_POST["memid"] .'More details have been sent on'. $_POST["email"]

用单引号将文本括起来。

让我知道它是否有效。

于 2016-07-03T18:40:08.070 回答