作者JoeHorn (每天都在公司玩OLG)
看板PHP
标题Re: [请益] 前往页面的问题
时间Sat Jul 26 01:54:05 2008
<?php
require_once("./phpmailer/class.phpmailer.php");
$mail=new PHPMailer();
$mail->IsSMTP();
$mail->Host="msa.hinet.net";
$mail->Fromm='';
$mail->FromName='阿';
$mail->AddAddress('xxxx');
$mail->CharSet='utf-8';
$mail->ContentType="text/html";
$mail->Subject='系统公告';
$mail->Body='已新增一项留言';
if ($mail->Send()) {
header('Location: index.php');
} else {
?>
<html>
<head>
<title>TITLE</title>
</head>
<body>
fail!
</body>
</html>
<?php
}
?>
有错误再来 output HTML 页面.......
--
Linux is for people who want to know why it works.
Mac is for people who don't want to know why it works.
DOS is for people who want to know why it does not work.
Windows is for people who don't want to know why it does not work.
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.173.168.127
1F:→ holik0123 :多谢回答,我想问一下如果在<html>上已完成,那body 07/26 02:15
2F:→ holik0123 :还会被执行吗? 07/26 02:15
3F:推 bigair :你可以在 header() 下面加上 exit() 解除你的疑虑 07/26 02:18
4F:推 HuangJC :简单说,header 是产生一些资料给 Client 看,并没有 07/26 02:46
5F:→ HuangJC :Server 自己想跳往哪个网页这种 JUMP 指令;如果有 07/26 02:47
6F:→ HuangJC :JUMP,那也不必 exit 了;header 给 Client 看,exit 给 07/26 02:47
7F:→ HuangJC :Server 看;而 Client 看了特定 header 是会想JUMP.. 07/26 02:48
8F:→ HuangJC :广义的说,setcookie 也动手脚在 header;而 header 名 07/26 02:48
9F:→ HuangJC :为 header,所以在其上就不能先有其他资料 07/26 02:49
11F:推 HuangJC :那个网址正好在争论题目 XD 07/26 08:13