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

PHPʵÏÖͼƬÉÏ´«

#################################
##########BY:Moskey.Tong#########
###########2009-11-15############
#########*תÔØÇë×¢Ã÷*############
#################################
×ܽáÒ»ÏÂÕâ¸öÐÇÆÚÌìPHPÉÏ´«Í¼Æ¬¡£
ÉÏ´«Í¼Æ¬Ô­Àí£ºÊ×ÏÈÅжÏÎļþÀàÐÍÊÇ·ñΪͼƬ¸ñʽ£¬ÈôÊÇÔòÉÏ´«Îļþ£¬È»ºóÖØÃüÃûÎļþ£¨Ò»°ã¶¼ÊDZÜÃâÉÏ´«ÎļþÖØÃû£¬ÏÖÔÚ»ù±¾É϶¼ÊÇÒÔΪʱ¼äÀ´ÃüÃû£©£¬½Ó×Å°ÑÎļþÉÏ´«µ½Ö¸¶¨Ä¿Â¼£¬³É¹¦ÉÏ´«ºóÊä³öÉÏ´«Í¼Æ¬µÄÔ¤ÀÀ¡£
1.Ê×ÏÈÎÒÃÇ¿ªÊ¼ÅжÏÎļþÀàÐÍÊÇ·ñΪͼƬÀàÐÍ
Óõ½µÄº¯Êý
{
strrchr:²éÕÒ×Ö·û´®ÔÚÁíÒ»¸ö×Ö·û´®ÖÐ×îºóÒ»´Î³öÏÖµÄλÖ㬲¢·µ»Ø´Ó¸ÃλÖõ½×Ö·û´®½áβµÄËùÓÐ×Ö·û¡£
substr: È¡²¿·Ý×Ö·û´®¡£
$HTTP_POST_FILES['file']['name']:»ñÈ¡µ±Ç°ÉÏ´«µÄÎļþÈ«³Æ¡£
}
ͼƬÀàÐ;ÍÊÇ“.”ºóÃæµÄ×Ö·û£¨±ÈÈ磺һ¸öÎļþÃû³ÆΪXXX.JPG ÄÇôËüµÄÀàÐ;ÍÊÇ“.”ºóÃæµÄJPG£©¡£
ÎÒÃÇ¿ÉÒÔÓÃPHPÖеĺ¯ÊýÀ´½ØÈ¡ÉÏ´«ÕßÎļþÃû×ֵġ£ÎÒÃÇÀ´Ð´¸ö»ñÈ¡ÎļþÀàÐ͵ĺ¯Êý
<?
function type()
{
return substr(strrchr($HTTP_POST_FILES['file']['name'],'.'),1);
}
?>
2.ÈôÊÇÔòÉÏ´«Îļþ£¬È»ºóÖØÃüÃûÎļþ
Óõ½µÄº¯Êý
{
strtolower:°Ñ×Ö·û´®µÄ×Öĸȫ²¿×ª»»ÎªÐ¡Ð´×Öĸ.
in_array£º º¯ÊýÔÚÊý×éÖÐËÑË÷¸ø¶¨µÄÖµ¡£
implode£ºº¯Êý°ÑÊý×éÔªËØ×éºÏΪһ¸ö×Ö·û´®
random:Ëæ»úÉú³ÉµÄÊý
$_FILES['userfile']['name']:ÉÏ´«ÎļþÃû³Æ
$uploaddir£º×Ô¼º¶¨ÒåµÄ±äÁ¿¡£±ÈÈçÔÚͬһ¸öÎļþ¼ÐÀïÃ棬ÄãÏë°ÑÉÏ´«µÄÎļþ·Åµ½Õâ¸öÎļþ¼ÐµÄFILEÎļþ¼ÐÏ£¬Äã¿ÉÒÔÕâÑù¶¨Òå$uploaddir="./file/"£»×¢Òâд·¨
}
Õâ±ß»á³öÏֺܶàÎÊÌ⣬µÚÒ»ÏÈдһ¸öÄÜÉÏ´«ÀàÐ͵ÄÊý×é¡£µÚ¶þÅжÏÎļþºÏ·¨ÐÔ¡£µÚÈý¸øÎļþÖØÃû¡£*£¨Õâ±ßÅжÏÎļþ´óС¾Í²»Ð´ÁË£©
Ïȶ¨ÒåÔÊÐíÉÏ´«ÎļþµÄÀàÐÍÊý×飺$type=array("jpg","gif","bmp","jpeg","png");
µÚ¶þÓÃÒ»¸öIF¡£¡£else¡£¡£Ð´Ò»¸öÅжÏÎļþºÏ·¨ÐԵĿØÖÆÁ÷Óï¾ä¡£
if(!in_arry(strtolower(type()),$type))//Èç¹û²»´æÔÚÄÜÉÏ´«µÄÀàÐÍ
{
  
$text=implode('.',$type);
   echo "ÄúÖ»ÄÜÉÏ´«ÒÔÏÂÀàÐÍÎļþ: ",$text,"<br>";
}
ÏÂÃæ¾ÍÊǸøËûÃÇÖØÐÂÃüÃûÁË,
else
{
  
$filename=explode(".",$_FILES['userfile']['name']);//°ÑÉÏ´«µÄÎļþÃûÒÔ“


Ïà¹ØÎĵµ£º

PHPÓ¦ÓÃmemcacheº¯ÊýÏê½â

Memcache::add — Ìí¼ÓÒ»¸öÖµ£¬Èç¹ûÒѾ­´æÔÚ£¬Ôò·µ»Øfalse
Memcache::addServer — Ìí¼ÓÒ»¸ö¿É¹©Ê¹ÓõķþÎñÆ÷µØÖ·
Memcache::close — ¹Ø±ÕÒ»¸öMemcache¶ÔÏó
Memcache::connect — ´´½¨Ò»¸öMemcache¶ÔÏó
memcache_debug — ¿ØÖƵ÷ÊÔ¹¦ÄÜ
Memcache::decrement — ¶Ô±£´æµÄij¸ökeyÖеÄÖµ½ ......

linuxÏ°²×°PHP APACHE MYSQL ÊÖ¼Ç

/**********************************
APACHE
***********************************/
±à¼­²ÎÊý£º
./configure" \
"--prefix=/usr/local/apache" \
"--enable-so" \
"--enable-ssl" \
"--enable-mods-shared=most" \
"--with-mpm=event" \
"--with-ssl=/usr/local/openssl" \
"--enable-cache" \
"--enable-mem- ......

php intÐ͵Ä×î´óÖµ

Ö´ÐÐÒÔÏÂÓï¾ä£º
var_dump(2147483647); // int
var_dump(
2147483648); // float
¿ÉÒÔ¿´µ½£¬php intÐ͵Ä×î´óÖµ¾ÍÊÇ
2147483647£¬¼´231
-1£¬ÒòΪ32λµÄ×î¸ßλҪÓÃÀ´±íʾÕý¸º¡£
ÔÙÖ´ÐÐÒÔÏÂÓï¾ä£º
$u = sprintf("%u",
2147483648); # ¸ü»»Îª%b,%dÊÔÊÔ
var_dump($u);
......

PHP+MySQLÂÒÂëµÄ½â¾ö

ÔÚDOSÖнøÐÐMySQLµÄ·ÃÎÊ¿ÉÄÜÂÒÂëµÄÇé¿öÓÐÈýÖÖ£¬
    Ê×ÏÈ£¬Òª×öµÄÊǼì²éMySQLµÄÅäÖ㬰²×°µÄʱºòÑ¡Ôñutf-8µÄÓïÑÔ»·¾³»áÊ¡È¥ºÜ¶àµÄÂé·³
1. ¼ì²éMySQLµÄ·þÎñ¶Ë¡¢¿Í»§¶ËµÄÓïÑÔÉèÖÃÊÇ·ñΪ“utf8”£¬²»ÊǵĻ°ÊÖ¶¯½«my.int¸ü¸Ä¹ýÀ´£»
2. ÔÚPHP½øÐеÚÒ»´Îmysql_query֮ǰÉèÖÃʹÓÃÁ¬½ÓµÄ×Ö·û¼¯Îª"SET N ......

ÉîÒ¹ÏÐÁÄJavaÓëPHP ÒÔ¼°¼Ü¹¹Éè¼Æ˼ÏëÓë×î¼Ñʵ¼ù

ÉîÒ¹ÏÐÁÄJavaÓëPHP ÒÔ¼°¼Ü¹¹Éè¼Æ˼ÏëÓë×î¼Ñʵ¼ù
·¢ÐÅÈË: wesley (ÐÄÖеÄÉ­ÁÖ), ÐÅÇø: Java
±ê  Ìâ: ÉîÒ¹ÏÐÁÄJavaÓëPHP ÒÔ¼°¼Ü¹¹Éè¼Æ˼ÏëÓë×î¼Ñʵ¼ù
·¢ÐÅÕ¾: ˮľÉçÇø (Thu Dec 24 01:55:04 2009), Õ¾ÄÚ
תÔØ×Ô±¾ÈËÐÂÀ˲©¿Í
http://blog.sina.com.cn/s/blog_53923f940100g7xx.html
£¨ÀÏÎâ×ÔÑÔ×ÔÓ
×î½üƵ·±ÌýË ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ