在PHP中使用mail()函数放置链接? [关闭]

This is just a general formatting question. I'm attempting to place a link in the e-mail function, but I'm having trouble placing a period at the end of the link without having it become part of the link. I've tried concatenating a period at the end of it, but after the e-mail is sent it becomes part of the link.

"http://google.com" . ".";

Would I need to use html to do this? Specifically <a href="">.</a>

EDIT: Additional information:

$txt = "Please follow this link to the form: '<a href="http://google.com"></a>.';"

I put the rest of the code on the same line on a new line, but it still doesn't seem to register properly.

<?php
    echo '<a href="http://google.com">Google</a>.';

the period belongs outside of the <a> tag. Anything inside the <a> tag will be part of the link

Update: OP has updated the question.

You basically had a single quote where you didn't need one and you weren't escaping your double quotes. I prefer to use single quotes in my strings so I don't have to escape double quotes, and it's cleaner to read.

$txt = 'Please follow this link to the form: <a href="http://google.com">Google</a>.';

or, if you prefer using double quotes, you have to escape them because your string is enclosed in double quotes.

$txt = "Please follow this link to the form: <a href=\"http://google.com\">Google</a>.";

Depending on your headers (& sometimes the e-mail client the user is using), a link won't actually render as a link. Anyhow, here's the basic set-up.

$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello. This is a <a href="http://google.com">link to Google</a>.';
$headers = 'From: webmaster@example.com' . "
" .
    'Reply-To: webmaster@example.com' . "
" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

It may also be worthwhile looking into a PHP library to send your e-mails. As it's super easy to send multipart e-mails. Take a look at SwiftMailer.