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²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall to undefined function 'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã ......
ÉèÖÃÊý¾Ý¿âÁ¬½Ó
<?php
/**
* @author [˹ÈË]
* @date 2010/6/1/10:16
* @
*
*/
define("RDFAPI_INCLUDE_DIR", "E:/siren/rdfapi-php/api/");
include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
//Á¬½Óµ½MSAccessÊý¾Ý¿â£¨rdf_db DSN£©µÄʹÓÃÁ¬½ÓÉèÖÃ
......
ÈÎÎñ£º¸ù¾ÝÊäÈëµÄÓòÃû ͳ¼ÆÒÔÏÂÈý¸öÊý¾Ý£¬µÚÒ»£ºÈ«ÇòÅÅÃû£»µÚ¶þ£ºÓû§Á¿£¨ÔÂÆ½¾ùÖµ£©£»µÚÈý£º
È˾ùÒ³Ãæ·ÃÎÊÁ¿£¨ÔÂÆ½¾ùÖµ£©¡£
˼·£ºÊ¹ÓÃget_file_contentsÌáÈ¡³öÍøÒ³ÄÚÈÝ£¬ÔÙ¸ù¾ÝÕýÔò±í´ïʽ½øÐÐÄÚÈݵÄɸѡ¡£
ºËÐĺ¯ÊýÈçÏ£º
<?php
/*
the function of getting aleax data
@param string partten  ......
apache:
Èç¹û²ÉÓÃRPM°ü°²×°£¬°²×°Â·¾¶Ó¦ÔÚ /etc/httpdĿ¼ÏÂ
apacheÅäÖÃÎļþ:/etc/httpd/conf/httpd.conf
ApacheÄ£¿é·¾¶£º/usr/sbin/apachectl
webĿ¼:/var/www/html
Èç¹û²ÉÓÃÔ´´úÂë°²×°£¬Ò»°ãĬÈϰ²×°ÔÚ/usr/local/apache2Ŀ¼ÏÂ
php:
Èç¹û²ÉÓÃRPM°ü°²×°£¬°²×°Â·¾¶Ó¦ÔÚ /etc/Ŀ¼ÏÂ
phpµÄÅäÖÃÎļþ:/etc/php.ini
......
#
Æô¶¯·þÎñµÄÓû§ºÍ×é
user
lighttpd lighttpd;
#
¿ª¶àÉÙ½ø³Ì
worker_processes
2;
#
´íÎóÈÕÖ¾
error_log
/data/log/nginx/nginx_error/nginx_error.log crit;
#
pid
pid
/var/run/nginx.pid;
#
Specifies
the value for maximum file descriptors t ......