php ͼƬÉÏ´«Àà´úÂë
<?
//http://www.jb51.net
class upLoad{
public $length; //ÏÞ¶¨Îļþ´óС
public $file; //ÅжϴËÀàÊÇÓÃÓÚͼƬÉÏ´«»¹ÊÇÎļþÉÏ´«
public $fileName; //ÎļþÃû
public $fileTemp; //ÉÏ´«ÁÙʱÎļþ
public $fileSize; //ÉÏ´«Îļþ´óС
public $error; //ÉÏ´«ÎļþÊÇ·ñÓдí,php4ûÓÐ
public $fileType; //ÉÏ´«ÎļþÀàÐÍ
public $directory; //
public $maxLen;
public $errormsg;
function __construct($length,$file=true,$directory)
{
$this->maxLen=$length;
$this->length=$length*1024;
$this->file=$file; //trueΪһ°ãÎļþ£¬falseΪͼƬµÄÅжÏ
$this->directory=$directory;
}
public function upLoadFile($fileField)
{
$this->fileName=$fileField['name'];
$this->fileTemp=$fileField['tmp_name'];
$this->error=$fileField['error'];
$this->fileType=$fileField['type'];
$this->fileSize=$fileField['size'];
$pathSign = DIRECTORY_SEPARATOR; // /
if($this->file) //Ò»°ãÎļþÉÏ´«
{
$path = $this->_isCreatedDir($this->directory);//È¡µÃ·¾¶
if($path)//http://www.jb51.net
{
$createFileType = $this->_getFileType($this->fileName);//ÉèÖÃÎļþÀà±ð
$createFileName=uniqid(rand()); //Ëæ»ú²úÉúÎļþÃû
$thisDir=$this->directory.$pathSign.$createFileName.".".$createFileType;
if(@move_uploaded_file($this->fileTemp,$thisDir)) //°ÑÁÙʱÎļþÒÆ¶¯µ½¹æ¶¨µÄ·¾¶ÏÂ
{
return $thisDir;
}
}
}else{ //ͼƬÉÏ´«
$path = $this->_isCreatedDir($this->directory);//È¡µÃ·¾¶
if($path)//·¾¶´æÔÚ//http://www.jb51.net
{
$createFileType = $this->_getFileType($this->fileName);//ÉèÖÃÎļþÀà±ð
$createFileName=uniqid(rand());
return
@move_uploaded_file($this->fileTemp,$this->directory.$pathSign.$createFileName.".".$createFileType)
? true : false;
}
}
}
public function _isBig($length,$fsize) //·µ»ØÎļþÊÇ·ñ³¬¹ý¹æ¶¨´óС
{
return $fsize>$length ? true : false;
}
public function _getFileType($fileName) //»ñµÃÎļþµÄºó׺
{
return end(explode(".",$fileName));
}
publi
Ïà¹ØÎĵµ£º
×¼±¸:
lighttpd-1.4.15.tar.gz
php-4.4.2.tar.gz
mysql-5.0.20a.tar.gz
¿ªÊ¼:
1 ±àÒë°²×°lighttpd
# tar zxvf lighttpd-1.4.15.tar.gz
# cd lighttpd-1.4.15
# ls
# ./configure --prefix=/usr/local/lighttpd //´Ë²¿ÎÞ·¨±àÒëʱÌáʾ°²×°prce-devel
#&nbs ......
PHPÈ¡µÃ³É¹¦µÄÒ»¸öÖ÷ÒªÔÒòÖ®Ò»ÊÇËýÓµÓдóÁ¿µÄ¿ÉÓÃÀ©Õ¹¡£web¿ª·¢ÕßÎÞÂÛÓкÎÖÖÐèÇó£¬ÕâÖÖÐèÇó×îÓпÉÄÜÔÚPHP·¢ÐаüÀïÕÒµ½¡£PHP·¢Ðаü°üÀ¨Ö§³Ö¸÷ÖÖÊý¾Ý¿â£¬Í¼ÐÎÎļþ¸ñʽ£¬Ñ¹Ëõ£¬XML¼¼ÊõÀ©Õ¹ÔÚÄÚµÄÐí¶àÀ©Õ¹¡£
¡¡¡¡À©Õ¹APIµÄÒýÈëʹPHPÈ¡µÃÁ˾޴óµÄ½øÕ¹£¬À©Õ¹API»úÖÆÊ¹PHP¿ª·¢ÉçÇøºÜÈÝÒ׵Ŀª·¢³ö¼¸Ê®ÖÖÀ©Õ¹¡£¡£À©Õ¹Ö÷ÒªµÄ˼ÏëÊÇ ......
ÕýÔò±í´ïʽ×Ô¼ºÒ»Ö±²»ÊìϤ£¬Õâ2ÌìÔÚÍøÉÏÒ»Ö±¿´¹ØÓÚËüµÄÎÄÕ£¬×Ô¼º×ܽáÁ˼¸¸öº¯Êý¡£
1£®preg_match()
º¯ÊýÔÐÍ£ºint preg_match (string $pattern, string $content [, array
$matches])
preg_match
()º¯ÊýÔÚ$content×Ö·û´®ÖÐËÑË÷Óë$pattern¸ø³öµÄÕýÔò±í´ïʽÏàÆ¥ÅäµÄÄÚÈÝ¡£Èç¹ûÌṩÁË$matches£¬Ôò½«Æ¥Åä½á¹û·ÅÈëÆäÖС ......
³ÌÐò´úÂë
<!--p
if(isset($_POST['md5'])){ //ÅжÏ$md5ÊÇ·ñÒÑÉèÖã¬Èç¹ûÉèÖÃÁËÔòÖ´ÐÐÒÔÏ´úÂë¡£
if(!is_numeric($_POST['time'])){ //Èç¹ûû»ñÈ¡µ½timeµÄÖµÔò½«timeµÄÖµÉèÖÃΪ30
$_POST['time'] = 30;
}
set_time_limit($_P ......