Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.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自定义代码substr消息_Php - Fatal编程技术网

PHP自定义代码substr消息

PHP自定义代码substr消息,php,Php,我有10个变量和一些数据(确认键、url、不同的消息等): 我想用代码替换$show\u现在的内容,我将写一个例子 $show_now = "Hi, thank you for registration, please check url: {confirmation_key}. Best regards {web_url}"; 必须替换为: $show_now = "Hi, thank you for registration, please check url: http://www.ex

我有10个变量和一些数据(确认键、url、不同的消息等):

我想用代码替换$show\u现在的内容,我将写一个例子

$show_now = "Hi, thank you for registration, please check url: {confirmation_key}. Best regards {web_url}";
必须替换为:

$show_now = "Hi, thank you for registration, please check url: http://www.example.com/?key=127e9kK. Best regards www.example.com";

如果您现在可以实际更改$show_,则更容易做到:

$show_now = "Hi, thank you for registration, please check url: $confirmation_key. Best regards $web_url";


如果你必须做stru_replace,那么另一个答案更好。

我假设这将显示为一个html页面,而不是一封电子邮件(即使这样也没有太大区别)。您可以尝试:

<h2> Confirmation </h2>
<p><strong>Payment Confirmation</strong><p>


<p>Hi your confirmation key is: <?php echo $voucher ?></p>
<p>Please check the following url: http://example.com/?key=<?php echo $key ?>
<br>Welcome to Our Program</p>
确认
付款确认
您好,您的确认码是:

请检查以下url:http://example.com/?key=
欢迎收看我们的节目

要以邮件的形式发送,它的结构并没有太大的不同,您只需使用邮件功能,并像您通常使用的任何确认电子邮件一样进行设置。但是内容可以这样发布


如果您没有将其输出到html或以电子邮件的形式发送,则必须明确显示此信息的位置。

RTFM:询问代码的问题必须表明您对所解决问题的理解程度最低。包括尝试过的解决方案、它们不起作用的原因以及预期结果。
$show_now = "Hi, thank you for registration, please check url: $confirmation_key. Best regards $web_url";
<h2> Confirmation </h2>
<p><strong>Payment Confirmation</strong><p>


<p>Hi your confirmation key is: <?php echo $voucher ?></p>
<p>Please check the following url: http://example.com/?key=<?php echo $key ?>
<br>Welcome to Our Program</p>