PHP自定义代码substr消息[关闭]

I have 10 variables with some data (confirmation keys, url, different message etc).:

$confirmation_key = "http://www.example.com/?key=127e9kK";
$web_url = "www.example.com";
$welcome_message = "Hello, welcome to our program!";

I want make replace $show_now contents with codes, I will write one example.

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

must be replaced to:

$show_now = "Hi, thank you for registration, please check url: http://www.example.com/?key=127e9kK. Best regards www.example.com";
$show_now = str_replace("\{confirmation_key\}", $confirmation_key, $show_now);

If you can actually change $show_now, it's easier to do:

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

http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double

If you have to do str_replace, then the other answer is better.

I'm assuming this is going to show up as an html page, rather than in an email (and even then it's not too different). You can try:

<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>

To send as mail, it's not very different in structure you just have to use the mail function and set it up as you normally would any confirmation email. But the content can be published like this.

If you are not outputting it to html, or sending it as an email then you'll have to be specific as to where you want this information displayed.