-3
 <?php 
 $m = ""; 
 $to = "anymail@gmail.com";                     
 $from = "anymail@mydomainname.com";
 $subject = 'subject';
 $message = "Any Message";
 $headers = "From: $from\n"; 
 $headers .= "MIME-Version: 1.0\n"; 
 $headers .= "Content-type:text/html; charset=iso-8859-1\n";
 if ( mail($to, $subject, $message, $headers) ) { 
     $m = "Email sent successfully"; exit(); 
 }else { 
     $m = "Email can't be sent.";exit();
 }  
 exit(); 
 ?>
 <!DOCTYPE HTML><html>
 <head><meta charset="utf-8"><title>Untitled Document</title></head>
 <body>
 <h2> 
 <?php  
   echo $m; 
 ?> </h2>
 </body></html> 

確認が取れません。誰でも問題を指摘できますか?

4

1 に答える 1

0

このコードを使用してexit()、実行を停止し、値を出力しない$m

if ( mail($to, $subject, $message, $headers) ) { 
   $m = "Email sent successfully"; 
   //exit(); 
}else { 
   $m = "Email can't be sent.";
   //exit();
}  
//exit(); 
于 2013-02-19T12:08:55.943 に答える