PHP mail Function With Attachments
ÔÌûµØÖ·£ºhttp://www.zedwood.com/article/126/php-mail-function-with-attachments
This code sends an html formatted email with attachments. This email sending script actually sends both a plaintext and an html body of the email, allowing the email client to choose which to display. The plaintext email is generated by stripping html tags from the html formatted body, and replacing
with newline characters.
One of the nice things about this script is that the attachments are stored in an array. If you want to add another attachment, all you have to do is copy and past an existing line in the attachment array, and change the filename.
For each attachment, it automatically looks up the corresponding mimetype.
$file1='test.pdf';
$file2='test2.tar.gz';
$head = array(
'to' =>array('email@email.net'=>'Admin',
'email2@email.net'=>'Admin2'),
'from' =>array('cron@55.66.77.88' =>'CronAgent'),
'cc' =>array('email3@email.net'=>'Admin'),
'bcc' =>array('email4@email.net'=>'Admin'),
);
$subject = date("Ymd")." Weekly Report";
$body ='';
$body.="<div style='font-family:Arial;font-size:10pt;'>";
$body.= "<br>"."Admin,";
$body.= "<br>"."";
$body.= "<br>"."Attached are the files:";
$body.= "<br>"."* ".$file1;
$body.= "<br>"."* ".$file2;
$body.=&nbs
Ïà¹ØÎĵµ£º
ÔÚphpÖмÆËãʱ¼ä²îÓÐʱºòÊǼþÂé·³µÄÊÂ!²»¹ýÖ»ÒªÄãÕÆÎÕÁËÈÕÆÚʱ¼äº¯ÊýµÄÓ÷¨ÄÇÕâЩҲ¾Í±äµÄ¼òµ¥ÁË:
Ò»¸ö¼òµ¥µÄÀý×Ó¾ÍÊǼÆËã½èÊéµÄÌìÊý,ÕâÐèÒªphp¸ù¾ÝÿÌìµÄÈÕÆÚ½øÐмÆËã,ÏÂÃæ¾ÍÀ´Ì¸Ì¸ÊµÏÖÕâÖÖÈÕÆÚ¼ÆËãµÄ¼¸ÖÖ·½·¨:
(1) Èç¹ûÓÐÊý¾Ý¿â¾ÍºÜÈÝÒ×ÁË!ÈôÊÇMSSQL¿ÉÒÔʹÓô¥·¢Æ÷!ÓÃרÃżÆËãÈÕÆÚ²îµÄº¯Êýdatediff()±ã¿É ......
PHP³ÌÐòÔ±×îÒ×·¸10ÖÖ´íÎó
PHPÊǸöΰ´óµÄweb¿ª·¢ÓïÑÔ£¬Áé»îµÄÓïÑÔ£¬µ«ÊÇ¿´µ½php³ÌÐòÔ±Öܶø¸´Ê¼µÄ·¸µÄһЩ´íÎó¡£ÎÒ×öÁËÏÂÃæÕâ¸öÁÐ±í£¬ÁгöÁËPHP³ÌÐòÔ±¾³£·¸µÄ10ÖдíÎ󣬴ó¶àÊýºÍ°²È«Ïà¹Ø¡£¿´¿´Äã·¸Á˼¸ÖÖ
1.²»×ªÒâhtml entities
Ò»¸ö»ù±¾µÄ³£Ê¶£ºËùÓв»¿ÉÐÅÈεÄÊäÈ루ÌرðÊÇÓû§´ÓformÖÐÌá½ ......
PHP»º´æ´úÂë
ºÃµÄÒ³Ã滺´æ´úÂ룬¿ÉÒÔ¼õÇáCPUºÍMYSQL¸ºµ£¡£Ê¹ÓÃÇ°£¬ÏÈÔÚ¸ùĿ¼´´½¨“cache”Îļþ¼Ð£¬È»ºóÔËÐÐ1.php£¬µÚÒ»´ÎÔËÐк͵ڶþ´ÎÔËÐÐËٶȲîÒìºÜ´ó¡£»¶ÓÊìϤPHPµÄÅóÓÑʹÓúÍÌáÒâ¼û¡£
ʹÓ÷½·¨:(Çë±£´æΪtemp.php)
<?php
include('arrcache.php');
$cache = new ArrCache('cache',5,'txt');
......
$_SERVER´æ´¢µ±Ç°·þÎñÆ÷ÐÅÏ¢£¬ÆäÖÐÓм¸¸öÖµÈç$_SERVER["QUERY_STRING"]£¬$_SERVER["REQUEST_URI"]£¬$_SERVER["SCRIPT_NAME"]ºÍ$_SERVER["PHP_SELF"]³£³£ÈÝÒ×»ìÏý£¬ÒÔÏÂͨ¹ýʵÀýÏê½â$_SERVERº¯ÊýÖÐQUERY_STRING£¬REQUEST_URI£¬SCRIPT_NAMEºÍPHP_SELF±äÁ¿Çø±ð£¬ÕÆÎÕÕâËÄÕßÖ®¼äµÄ¹Øϵ£¬±ãÓÚÔÚʵ¼ÊÓ¦ÓÃÖÐÕýÈ·»ñÈ¡ËùÐèÒªµÄÖµ
1£ ......
ÔÚjavascriptÖÐÓ÷¨¾ÙÀý
var rule = /^\d+$/;
if(!rule.test(addform.rmb_price.value)) {
alert('rmb_price must be number');
addform.rmb_price.focus();
return false;
}
ÔÚphpÖÐÓ÷¨¾ÙÀý
$aa = "/^\d+$/";
if(preg_match($aa, "111")) {
echo "found";
}
ÔÚjavaÖÐÓ÷¨¾ÙÀý ......