Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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


Ïà¹ØÎĵµ£º

phpÁ¬½Ómysql²âÊÔºÍÅäÖÃ


phpÁ¬½Ómysql²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall   to   undefined   function   'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã ......

phpÖÐʹÓÃheaderº¯ÊýµÄhttpÍ·ÉèÖÃ

/ ok
header('HTTP/1.1 200 OK');
//ÉèÖÃÒ»¸ö404Í·:
header('HTTP/1.1 404 Not Found');
//ÉèÖõØÖ·±»ÓÀ¾ÃµÄÖØ¶¨Ïò
header('HTTP/1.1 301 Moved Permanently');
//תµ½Ò»¸öеØÖ·
header('Location: http://www.example.org/'
);
//ÎļþÑÓ³ÙתÏò:
header('Refresh: 10; url=http://www.example.org/');
print 'Y ......

phpÑéÖ¤ÂëÏÔʾºìÉ«²æ²æ

phpÑéÖ¤ÂëÏÔʾºìÉ«²æ²æ
Õâ¸öÎÊÌâÀ§ÈÅÎÒ°ëÌìÁË¡£ÔÚ±¾»úÉϲâÊÔÊÇÕý³£µÄ£¬»·¾³ÊÇwin2003+php+mssql.ÏÔʾÕý³£¡£
ÏÖÔÚÎҰѳÌÐò×ªÒÆµ½Ð·þÎñÆ÷ÉÏ£¬ÑéÖ¤Âë¾Í²»ÏÔʾÁË£¬²»ÖªµÀÊÇʲôÇé¿ö£¬ÎÒ¼ì²âÁË·þÎñÆ÷»·¾³£¬gdÊÇÖ§³ÖµÄ£¬ÈçÏÂͼ:
µ«ÊÇ£¬¾ÍÊDz»ÏÔʾ£¬ÈçÓиßÊÖ£¬Çë¸úÌû£¬Ð»Ð»ÁË¡£ ......

PHPдµÄMD5ÆÆ½âÓë¼ÓÃܳÌÐò

³ÌÐò´úÂë
<!--p
  if(isset($_POST['md5'])){ //ÅжÏ$md5ÊÇ·ñÒÑÉèÖã¬Èç¹ûÉèÖÃÁËÔòÖ´ÐÐÒÔÏ´úÂë¡£
  if(!is_numeric($_POST['time'])){ //Èç¹ûû»ñÈ¡µ½timeµÄÖµÔò½«timeµÄÖµÉèÖÃΪ30
    $_POST['time'] = 30;
      }
    set_time_limit($_P ......

PHPÄ£ÄâʵÏÖJavaµÄendsWith

      JavaÖеÄstartsWithºÍendsWith·½·¨£¬ÔÚfilterµÄ¹¦ÄÜʵÏÖÖкܷ½±ã£¬PHP¿ÉÒÔÓÃstrncmp()
ʵÏÖstartsWith£¬µ«ÊÇÎÞ·¨ÊµÏÖendsWith£¬ÓÐЩÈË»áÓÃÕýÔòÀ´ÊµÏÖ£¬µ«´ó¶àÊýÈ˶¼²»Ï²»¶ÕýÔò±í´ïʽµÄ²Ù×÷¡£
      ÕâÀïÎÒͨ¹ýÒ»¸ö½Ðsubstr_compareµÄ·½·¨ÊµÏÖ(ͬʱËûÒ²ÄÜʵÏÖsta ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ