我正在创建一个网站,其中包含一个按钮(JPEG图像),该按钮将定位(' ref')一个php文件。我需要在' email.jpg'时调用php。单击按钮但仅在Web浏览器中显示为纯文本。关于如何解决这个问题的任何想法?任何帮助深表感谢!感谢
主要HTML网站代码
<div id="content-container">
<p align="center"><a href="video.mp4" class="html5lightbox" data-width="720" data-height="404"><img src="bg.jpg" width="1023" height="820" id="imgvideo" /></a>
<div align="center">
<table width="1027" height="46" border="0" cellpadding="0px">
<tr>
<td><a href="mail.php"><img src="email.png" width="130" height="46" /></a></td>
</tr>
</table>
</div>
</div>
PHP文件代码(mail.php)
<?php
/*EMAIL TEMPLATE BEGINS*/
$imgSrc = 'bg.jpg';
$imgDesc = 'test_sell_new/';
$imgTitle = 'bg.jpg';
$subjectPara1 = 'Now Available';
$subjectPara2 = NULL;
$subjectPara3 = NULL;
$subjectPara4 = NULL;
$subjectPara5 = NULL;
$message = '<!DOCTYPE HTML>'.
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'.
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'.
'<html xmlns="http://www.w3.org/1999/xhtml">'.
'<head>'.
'<title>Available Now</title>'.
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'.
'</head>'.
'<body style="background-color:#ffffff; padding:0; margin:-10px 0 0 0; _margin:0 0 0 0; *margin:0 0 0 0; text-align:center;">'.
'<table border="0" cellpadding="0" cellspacing="0" width="1024" style="background-color:#ffffff; font-family:Arial, Helvetica, sans-serif; font-size:10px; padding-top:0px; margin:auto;">'.
'<tr>'.
'.<td><a href="index.html" style="text-decoration:none"><p style="color:#000000; text-align:center; margin:10px 0 0 0; *margin:0 0 0 0; _margin:0 0 0 0; font-family:Arial, Helvetica, sans-serif; font-size:11px;">Having trouble viewing this message? Click here.</p></a></td>'.
'</tr>'.
'<tr>'.
'<td>'.
'<table border="0" cellspacing="0" cellpadding="0" width="100%" height="820">'.
'<tr>'.
'<td>'.
'<a href="index.html"><img src="bg.jpg" width="1024" height="820" border="0" /></a><br />'.
'</td>'.
'</tr>'.
'</table>'.
'</td>'.
'</tr>'.
'</table>'.
'</body>'.
/*EMAIL TEMPLATE ENDS*/
$to = 'test@madeup.com';
$subject = 'IT WORKS!';
$from = 'test@madeup.com';
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "CC: test@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
?>
答案 0 :(得分:1)
您实际上并未对模板进行任何操作,请使用mail()发送。
mail($to,$subject,$message, $headers);
答案 1 :(得分:0)
在php文档的开头试试这个
header('Content-type: text/plain');
这将强制浏览器呈现为文本而非HTML