วันอังคารที่ 8 พฤษภาคม พ.ศ. 2555

การส่ง mail php

 ฟังกชันใช้ในการส่ง mail
<?
mail($strTo,$strSubject,$strMessage,$strHeader);
?>
ตัวอย่าง
<html>
<head>
<title>PHP Sending Email</title>
</head>
<body>
<?
 $strTo = "fary_pepo@hotmail.com";//ส่งเมล์ถึงใคร
 $strSubject = "Test Send Email"; //หัวข้อเมล์
 $strHeader = "From:fary_pepo@hotmail.com"; //ส่งจากใคร
 $strMessage = "My Body & My Description";//ข้อความที่ส่ง
 $Send = @mail($strTo,$strSubject,$strMessage,$strHeader);  
 if($Send)
 {
  echo "Email Sending.";
 }
 else
 {
  echo "Email Can Not Send.";
 }
?>
</body>
</html> 

วันพุธที่ 2 พฤษภาคม พ.ศ. 2555

การ export file excel ด้วยภาษา php

เพิ่มโค้ดนี้ลงไปส่วนบนสุดของหน้า
<?
header("Content-Type: application/x-msexcel");
header("content-disposition: attachment;filename=Data_bill.xls");
echo "<meta http-equiv='Content-Type' content='text/html; charset=windows-874'>";
?>