drbouzlxb92333332 2016-07-03 04:46
浏览 70
已采纳

在简单的引号PHP中插入一个变量

How i can use a variable ($_REQUEST('subject')) inside simple quotation marks. This is my code:

<?php
$uri = 'https://mandrillapp.com/api/1.0/messages/send.json';

$postString = '{//i can't quit this quotation mark
"key": "myapi",
"message": {
    "html": "this is the emails html content",
    "subject": "$_REQUEST['subject'];",//this dont work
    "from_email": "email@mydomain.com",
    "from_name": "John",
    "to": [
        {
            "email": "test@hotmail.com",
            "name": "Bob"
        }
    ],
    "headers": {
    },
    "auto_text": true
},
"async": false
}';
?>
  • 写回答

3条回答 默认 最新

  • dqk94069 2016-07-03 04:50
    关注

    change "subject": "$_REQUEST['subject'];" to "subject": "' . $_REQUEST['subject'] . '"

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?