Don't显示PHP表单操作页面
Don't show PHP form action page
我有一个页面,它使用HTML表单通过电子邮件发送图像。它的功能很好,但当用户单击SEND email时,它会显示SEND.php页面后面的整个操作。如何向用户隐藏此信息。如果我能在页面上显示一些文字,上面写着"你的消息已经发送!!",那就太好了。
<form name="form1" method="post" action="email/send.php">
<input type=button value="Take HD Snapshot" onClick="take_snapshot()">
<input type="submit" name="Submit" value="Send Email">
</form>
SEND.PHP如下。它是一个PHPILER插件。
<?php
/**
* This example shows settings to use when sending via Google's Gmail servers.
*/
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require 'PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 1;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = 'mail_server';
// use
// $mail->Host = gethostbyname('mail_server');
// if your network does not support SMTP over IPv6
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "username";
//Password to use for SMTP authentication
$mail->Password = "password";
//Set who the message is to be sent from
$mail->setFrom('username', 'Name');
//Set an alternative reply-to address
$mail->addReplyTo('Name', 'Name');
//Set who the message is to be sent to
$mail->addAddress('Name', 'Name');
//Set the subject line
$mail->Subject = 'PHPMailer GMail SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Add an Attachment
$mail->AddAttachment("../snapshots/image.jpg");
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
解决方案是将PHPILER更改为不包括调试
$mail->SMTPDebug=0;(它在1上)
相关文章:
- 如何根据所选选项值重定向表单操作
- 从输入时提交到jQuery,无需提交按钮,无需表单操作
- 使用Javascript/jQuery以编程方式将当前锚点/哈希/片段附加到任何表单操作url
- 表单操作值未从attr()函数中获取
- JavaScript 表单操作更改RC方法发布文本输入提交
- “表单操作”和“点击时提交表单”都将执行
- 动态更改表单操作以生成iframe
- 从HTML表单中获取计算得到的JavaScript数据,并将其作为新元素添加到相同的表单操作中以使用PHP保存
- html表单操作跨域目标iframe
- SSL/JS错误破坏了我页面上的表单操作
- 如何正确地将异步回调与react中的表单操作连接起来
- 表单操作过程中出现后退按钮问题
- extjs,如何在表单操作中绑定事件
- 表单操作查询字符串中需要下拉选项值
- 动态更改表单操作url
- HTML表单操作是在值前面,而不是在值后面
- 将java脚本变量传递给相同的表单操作php文件参数
- jQuery:$.ajax() 重定向到其 URL 表单操作参数,而不是对表单操作执行 AJAX 请求
- 代码点火器通过单击按钮更改表单操作
- 表单操作 一个外部 JavaScript 函数