Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÖеÄÖµ½ ......

Run PHP on the Google App Engine

Google launched their Google App Engine (GAE) a year ago. The free hosting in App Engine is allocated 500 MB of persistent storage and enough CPU and bandwidth for about 5 million page views a month. Also, if you really want more you can see pricing plans.
GAE will support Java going forw ......

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³£ÓÃÀàÕûÀí

ÔÚʵ¼Ê¿ª·¢¹ý³Ì»á¾­³£»áÓöµ½Ò»Ð©Öظ´µÄ²Ù×÷£¬Èç¹ûÿ´Î¶¼Òª×Ô¼ºÈ¥ÊµÏÖÕâÎÞÒɼÓÖØÁË×Ô¼ºµÄ¹¤×÷Á¿£¬ÏÂÃæ¶ÔһЩ¿ÉÄܾ­³£Óõ½µÄÀà×ö¸öÕûÀí£º
ͼ±í¿â
ÏÂÃæµÄÀà¿â¿ÉÒÔÈÃÄãºÜ¼òµ¥¾ÍÄÜ´´½¨¸´ÔÓµÄͼ±íºÍͼƬ¡£µ±È»£¬ËüÃÇÐèÒªGD¿âµÄÖ§³Ö¡£
pChart - Ò»¸ö¿ÉÒÔ´´½¨Í³¼ÆͼµÄ¿â¡£
Libchart - ÕâÒ²ÊÇÒ»¸ö¼òµ¥µÄͳ¼Æͼ¿â¡£
JpGraph - Ò» ......

ʹÓÃlinux¹²ÏíÄÚ´æµÄʵÏÖµÄphpÄÚ´æ¶ÓÁÐ

<?php
/**
* ʹÓù²ÏíÄÚ´æµÄPHPÑ­»·ÄÚ´æ¶ÓÁÐʵÏÖ
* Ö§³Ö¶à½ø³Ì, Ö§³Ö¸÷ÖÖÊý¾ÝÀàÐ͵Ĵ洢
* ×¢: Íê³ÉÈë¶Ó»ò³ö¶Ó²Ù×÷,¾¡¿ìʹÓÃunset(), ÒÔÊÍ·ÅÁÙ½çÇø
*
* @author wangbinandi@gmail.com
* @created 2009-12-23
*/
class SHMQueue
{
private $maxQSize = 0; // ¶ÓÁÐ×î´ó³¤¶È

private $front = 0; ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ