1 2 3 4 下一页 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: Peterrn"; $headers .= "Reply-To: info@yoursite.comrn"; $headers .= "Return-Path: info@yoursite.comrn"; $headers .= "X-Mailer: PHP5n"; $headers .= 'MIME-Version: 1.0' . "n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn"; 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(
10段PHP常用功能代码_网学
SERVER['HTTP_CLIENT_IP'])) //check ip from share internet { $ip=
10段PHP常用功能代码_网学
SERVER['HTTP_CLIENT_IP']; } elseif (!empty(
10段PHP常用功能代码_网学
SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy { $ip=
10段PHP常用功能代码_网学
SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip=
10段PHP常用功能代码_网学
SERVER['REMOTE_ADDR']; } return $ip; }
(责任编辑:admin) |