10¶ÎPHP³£Óù¦ÄÜ´úÂë
1¡¢Ê¹ÓÃPHP Mailº¯Êý·¢ËÍEmail
$to = "viralpatel.net@gmail.com";
$subject = "VIRALPATEL.net";
$body = "Body of your message here you can use HTML too. e.g. ﹤br﹥ ﹤b﹥ Bold ﹤/b﹥";
$headers = "from: Peter\r\n";
$headers .= "Reply-To: info@yoursite.com\r\n";
$headers .= "Return-Path: info@yoursite.com\r\n";
$headers .= "X-Mailer: PHP5\n"; $headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$body,$headers);
2¡¢PHPÖеÄ64λ±àÂëºÍ½âÂë
function base64url_encode($plainText) {
$base64 = base64_encode($plainText);
$base64url = strtr($base64, '+/=', '-_,');
return $base64url;
}
function base64url_decode($plainText) {
$base64url = strtr($plainText, '-_,', '+/=');
$base64 = base64_decode($base64url);
return $base64;
}
3¡¢»ñÈ¡Ô¶³ÌIPµØÖ·
function getRealIPAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
4¡¢ ÈÕÆÚ¸ñʽ»¯
function checkDateFormat($date)
{
//match the format of the date
if (preg_match ("/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/", $date, $parts))
{//check weather the date is valid of not
if(checkdate($parts[2],$parts[3],$parts[1]))
return true;
else
return false;
}
else
return false;
}
5¡¢ÑéÖ¤Email
$email = $_POST['email'];
if(preg_match("~([a-zA-Z0-9!#$%&'*+-/=?^_`{|}~])@([a-zA-Z0-9-]).
([a-zA-Z0-9]{2,4})~",$email)) {
echo 'This is a valid email.';
} else{
echo 'This is an invalid email.';
}
6¡¢ÔÚPHPÖÐÇáËɽâÎöXML
//this is a sample xml string
$xml_string="﹤?x
Ïà¹ØÎĵµ£º
Ò»£º½á¹¹ºÍµ÷ÓÃ(ʵÀý»¯)£º
class className{} £¬µ÷Óãº$obj = new className();µ±ÀàÓй¹Ô캯Êýʱ£¬»¹Ó¦´«Èë²ÎÊý¡£Èç$obj = new className($v,$v2...);
¶þ£º¹¹Ô캯ÊýºÍÎö¹¹º¯Êý£º
1¡¢¹¹Ô캯ÊýÓÃÓÚ³õʼ»¯£ºÊ¹ÓÃ__construct()£¬¿É´ø²ÎÊý¡£
2¡¢µ«Îö¹¹º¯Êý²»ÄÜ´ø²ÎÊý£¨ÓÃÓÚÔÚÏúÈ¥Ò»¸öÀà֮ǰִÐÐһЩ²Ù×÷»ò¹¦ÄÜ£©¡£Îö¹¹º¯Êý ......
< type="text/javascript">
smarty ¿ÉÒÔÉú³É£¬
ÆäʵÉú³ÉµÄÔÀíºÜ¼òµ¥
1¡¢»ñÈ¡Ä㶯̬ҳÃæµÃÄÚÈÝ
2¡¢Ð´È뾲̬Îļþ
±ÈÈ磺
<?
//»ñÈ¡ÎļþÄÚÈÝ
$content=file_get_contents(http://www.www.com/viewPage.php?id=$id
);
//¼ì²éÊÇ·ñ´æÔÚ¾ÉÎļþ£¬ÓÐÔòɾ³ý
i ......
ϵͳÉè¼Æ´ÓÒ»¿ªÊ¼¾ÍÓ¦¸Ã¿¼ÂDz»Í¬Æ½Ì¨µÄ¼æÈÝÐÔÎÊÌ⣬×î³£¼ûÒ»¸öÎÊÌâ¾ÍÊÇLinux/uniuxÓëWinµÄһЩ²»Í¬£¬±ÈÈç˵Îļþ·¾¶·Ö¸ô·û¡¢¶à¸ö·¾¢·Ö¸ô·ûµÈµÈ¡£PHP±¾ÉíÄÚÖÃÁ˺ܶೣÁ¿£¬ÔÚ·½±ãµÄ±àд´úÂëͬʱҲºÜºÃµÄ´¦ÀíºÃÁ˲»Í¬Æ½Ì¨ÏµÄһЩ¼æÈÝÐÔÎÊÌâ¡£±ÈÈç×î³£Óõģº
DIRECTORY_SEPARATOR ·¾¶·Ö¸ô·û£¬WinÏÂÊÇ"\"¶ ......
phpµ¼Èëµ½excel-Ö§³Öutf8ºÍgbkÁ½ÖÖ±àÂë
phpµ¼Èëµ½excelÂÒÂëÊÇÒòΪutf8±àÂëÔÚxpϵͳ²»Ö§³ÖËùÓÐutf8±àÂëתÂëһϾÍÍêÃÀ½â¾öÁË
utf-8±àÂë°¸Àý
<?php
header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
header("Pragma: public");
header("Expires: 0");
header("Cache ......