php³£Óü¼ÇÉ
ÈçºÎÅжÏipµØÖ·ºÏ·¨ÐÔ
if(!strcmp(long2ip(sprintf("%u",ip2long($ip))),$ip)) echo "is ipn";
emailµÄÕýÔòÅжÏ
eregi("^[_.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z_-]+.)+[a-zA-Z]$", $email);
¼ì²âipµØÖ·ºÍmaskÊÇ·ñºÏ·¨µÄÀý×Ó
$ip = '192.168.0.84';
$mask = '255.255.255.0';
$network = '192.168.0';
$ip = ip2long($ip);
$mask = ip2long($mask);
$network = ip2long($network);
if( ($ip & $mask) == $network) echo "valid ip and maskn";
?>
ÎļþÏÂÔØÍ·²¿Êä³öÈçºÎÉ趨
header("Content-type: application/x-download");
header("Content-Disposition: attachment; filename=$file_download_name;");
header("Accept-Ranges: bytes");
header("Content-Length: $download_size");
echo 'xxx'
ÓÃheaderÊä³öftpÏÂÔØ·½Ê½,²¢ÇÒÖ§³Ö¶ÏµãÐø´«
Ò»¸öÀý×Ó:
header('Pragma: public');
header('Cache-Control: private');
header('Cache-Control: no-cache, must-revalidate');
header('Accept-Ranges: bytes');
header('Connection: close');
header("Content-Type: audio/mpeg");
header("Location:ftp://download:1bk3l4s3k9s2@232.2.22.22/2222/web¼¼Êõ¿ª·¢ÖªÊ¶¿â/cn_web.rmvb");
ÕýÔòÆ¥ÅäÖÐÎÄ
ereg("^[".chr(0xa1)."-".chr(0xff)."]+$", $str);
ÅúÁ¿Ìæ»»Îı¾ÀïÃæµÄ³¬¼¶Á´½Ó
<?php
function urlParse($str = ''){
if ('' == $str) return $str;
$types = array("http", "ftp", "https");
$replace = <<<EOPHP
'<a href="'.htmlentities('\1').htmlentities('\2').'">'.htmlentities('\1').htmlentities('\2').'</a>'
EOPHP;
$ret = $str;
while(list(,$type) = each($types)){
$ret = preg_replace("|($type://)([^\s]*)|ie ", $replace, $ret);
}
return $ret;
}
?>
Ïà¹ØÎĵµ£º
in_array(value,array,type)
in_array ×÷ÓÃÊÇÓÃÓڲ鿴 value ÊÇ·ñÔÚ array ÖдæÔÚ£¬Èç¹û²ÎÊý value ÊÇ×Ö·û´®£¬ÇÒ type ²ÎÊýÉèÖÃΪ true£¬ÔòËÑË÷Çø·Ö´óСд¡£Ôò in_array ÊÇ Çø·Ö´óСд µÄ¡£
ÓÐÒ»µãÐèҪעÒ⣬µ± array Öаüº¬ value µÄÖµ£¬Ôò·µ»Ø true£» µ«ÊÇ£¬Èç¹ûÁ½Õß²ÎÊýÖ®¼äÏàµÈ£¬Ôò·µ»Ø false
ÀýÈ磺
$str = 'a';
......
PHPÓкܶà»úÖÆ¡¢º¯Êý£¬Æäʵ¾ÍÊÇħÊõʦ£¬Öظ´·¢»ÓºÃ£¬ÆäʵÉõÖÁÊǼòµ¥Ó¦Ó㬾ͻá³öÏÖÉñÆæµÄЧ¹û¡£ÕâÀï½²Ò»¸öob_start()º¯Êý¡£
ob_start()º¯ÊýÓÃÓÚ´ò¿ª»º³åÇø,±ÈÈçheader()º¯ÊýÖ®
ǰÈç¹û¾ÍÓÐÊä³ö,°üÀ¨»Ø³µ\¿Õ¸ñ\»»ÐÐ\¶¼»áÓДHeader had all ready send
by”µÄ´íÎó,Õâʱ¿ÉÒÔÏÈÓÃob_start()´ò¿ª»º³åÇøPHP´úÂëµÄÊý¾ ......
ÔÚΪÓû§Ìṩ¶¯Ì¬ÄÚÈÝ·½Ã棬PHPºÍMySQLÊÇÒ»¸öÇ¿´óµÄ×éºÏ¡£ÕâЩÄêÀ´£¬ÕâÁ½Ïî²úÆ·ÒѾ¿çÔ½ÁËËüÃÇ×î³õµÄÓ¦ÓÃÎę̀£¬ÏÖÔÚ£¬Ò»Ð©ÊÀ½çÉÏ×æµÄÍøÕ¾Ò²ÔÚÓ¦ÓÃËüÃÇ¡£ËäÈ»ËüÃǵ±³õ¶¼ÊÇ¿ªÔ´Èí¼þ£¬Ö»ÄÜÔÚUNIX/LinuxÉÏÔËÐУ¬µ«¾¹ýÏ൱һ¶ÎʱÆÚµÄ·¢Õ¹£¬ËüÃÇÒÑÄÜÔÚWindowsƽ̨ÉÏÔËÐС£
ÔÚ±¾ÎÄÖУ¬ÎÒ½«Öð²½ÎªÄãÃÇ˵Ã÷ÈçºÎÔÚWindows»·¾³ÖÐ ......
1.²úÉúËæ»ú×Ö·û´®º¯Êý
function random($length) {
$hash = '';
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++) {
$ha ......
Îļþ¶ÁÈ¡º¯Ê½
//Îļþ¶ÁÈ¡º¯Ê½
function PHP_Read($file_name) {
$fd=fopen($file_name,r);
while($bufline=fgets($fd, 4096)){
$buf.=$bufline;
}
fclose($fd);
return $buf;
}
& ......