Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP-中断变量_Php_Sendmail_Var - Fatal编程技术网

PHP-中断变量

PHP-中断变量,php,sendmail,var,Php,Sendmail,Var,简单的问题是,如何在PHP中的变量之间设置一个分隔符,并在其间插入另一个变量?例如,我想发送一封带有激活URL的电子邮件,该URL在前面定义为$acticode。如何将其插入以下内容(我在下面尝试的方法不起作用) 整个片段: $acticode = "12345"; $subject = "Please activate your account"; $message = "Your activation code is" , $acticode , "and you ca

简单的问题是,如何在PHP中的变量之间设置一个分隔符,并在其间插入另一个变量?例如,我想发送一封带有激活URL的电子邮件,该URL在前面定义为$acticode。如何将其插入以下内容(我在下面尝试的方法不起作用)

整个片段:

$acticode = "12345";
    $subject = "Please activate your account";
       $message = "Your activation code is" , $acticode , "and you can activate it at blah blah";
       $header = "From:test@test.com \r\n";
       $retval = mail ($email,$subject,$message,$header);

串联运算符是
(句点)

你需要

$message = "Your activation code is" . $acticode . "and you can activate it at blah blah";

非常好用,谢谢much@TheDoonker也可以将变量放在实际字符串中,只要字符串包含在双引号(“)中。
$message = "Your activation code is" . $acticode . "and you can activate it at blah blah";