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

(תÔØ)ÓÅ»¯PHP´úÂëµÄ40Ìõ½¨Òé

Ô­ÎÄÁ´½Ó£ºhttp://webdev.csdn.net/page/58438f5e-704e-4e80-bdbd-7d06e8ecceb9#
40 Tips for optimizing your php Code
Ô­ÎĵØÖ·£ºhttp://reinholdweber.com/?p=3
Ó¢ÎÄ°æȨ¹éReinhold WeberËùÓУ¬ÖÐÒëÎÄ×÷Õßyangyang£¨aka davidkoree£©¡£Ë«Óï°æ¿ÉÓÃÓÚ·ÇÉÌÒµ´«²¥£¬µ«Ðë×¢Ã÷Ó¢ÎÄ°æ×÷Õß¡¢°æȨÐÅÏ¢£¬ÒÔ¼°ÖÐÒëÎÄ×÷Õß¡£·­ÒëˮƽÓÐÏÞ£¬Çë¹ã´óPHPerÖ¸Õý¡£
1. If a method can be static, declare it static. Speed improvement is by a factor of 4. Èç¹ûÒ»¸ö·½·¨¿É¾²Ì¬»¯£¬¾Í¶ÔËü×ö¾²Ì¬ÉùÃ÷¡£ËÙÂÊ¿ÉÌáÉýÖÁ4±¶¡£
2. echo is faster than print. echo ±È print ¿ì¡£
3. Use echo’s multiple parameters instead of string concatenation. ʹÓÃechoµÄ¶àÖزÎÊý£¨Òë×¢£ºÖ¸ÓöººÅ¶ø²»ÊǾäµã£©´úÌæ×Ö·û´®Á¬½Ó¡£
4. Set the maxvalue for your for-loops before and not in the loop. ÔÚÖ´ÐÐforÑ­»·Ö®Ç°È·¶¨×î´óÑ­»·Êý£¬²»ÒªÃ¿Ñ­»·Ò»´Î¶¼¼ÆËã×î´óÖµ¡£
5. Unset your variables to free memory, especially large arrays. ×¢ÏúÄÇЩ²»ÓõıäÁ¿ÓÈÆäÊÇ´óÊý×飬ÒÔ±ãÊÍ·ÅÄÚ´æ¡£
6. Avoid magic like __get, __set, __autoload ¾¡Á¿±ÜÃâʹÓÃ__get£¬__set£¬__autoload¡£
7. require_once() is expensive require_once()´ú¼Û°º¹ó¡£
8. Use full paths in includes and requires, less time spent on resolving the OS paths. ÔÚ°üº¬ÎļþʱʹÓÃÍêÕû·¾¶£¬½âÎö²Ù×÷ϵͳ·¾¶ËùÐèµÄʱ¼ä»á¸üÉÙ¡£
9.
If you need to find out the time when the script started executing,
$_SERVER[’REQUEST_TIME’] is preferred to time()
Èç¹ûÄãÏëÖªµÀ½Å±¾¿ªÊ¼Ö´ÐУ¨Òë×¢£º¼´·þÎñÆ÷¶ËÊÕµ½¿Í»§¶ËÇëÇ󣩵Äʱ¿Ì£¬Ê¹ÓÃ$_SERVER[‘REQUEST_TIME’]ÒªºÃÓÚtime()¡£
10. See if you can use strncasecmp, strpbrk and stripos instead of regex. ¼ì²éÊÇ·ñÄÜÓÃstrncasecmp£¬strpbrk£¬striposº¯Êý´úÌæÕýÔò±í´ïʽÍê³ÉÏàͬ¹¦ÄÜ¡£
11.
str_replace is faster than preg_replace, but strtr is faster than
str_replace by a factor of 4.
str_replaceº¯Êý±Èpreg_replaceº¯Êý¿ì£¬µ«strtrº¯ÊýµÄЧÂÊÊÇstr_replaceº¯ÊýµÄËı¶¡£
12.
If the function, such as string replacement function, accepts both
arrays and single characters as arguments, and if your argument list is
not too long, consider writing a few redund


Ïà¹ØÎĵµ£º

Ewebeditor±à¼­Æ÷ǶÈëµ½PHPÍøÒ³ÖÐ

/*
>>>  Title    : Ewebeditor±à¼­Æ÷ǶÈëµ½PHPÍøÒ³ÖÐ
>>> Author: Áõ³¿êÍ 
>>> Date   : 2009-07-05
>>> EMAIL :
huichengongzi@gmail.com
>>> תÔØÇë×¢Ã÷³ö´¦£¬Ð»Ð»ºÏ×÷£¡
*/
£¨1£©ÔÚ
</head>
֮ǰ¼ÓÉÏÏÂÃæÒ»¶Î´úÂ룺£¨µÃ ......

°²×°phpÖ§³Ömssql,curl,gd¿âµÈ

ÏÈ°²×°µÄzlib ./configure --prefix=/usr/local/zlib È»ºó×°µÄcurl ./configure --prefix=/usr/local/curl --with-zlib=/usr/local/zlib °²×°gdĬÈÏ°²×° ./configure --prefix=/usr/local/gd --with-zlib=/usr/local/zlib (ÓÐЩǰÃæÏÈ°²×°jepg,png...with¾Í¿ÉÒÔÁË,Ö®ºóphpµÄʱºò¿´./configure --helpÀïÃæÓоßÌåµÄ) ° ......

CentOS 5.2 ÏÂÓÃYum°²×°Apache+PHP+MySQL»·¾³


1.
CentOS 5.2 ÏÂÓÃYum°²×°Apache+PHP+MySQL»·¾³
2009-04-03 23:47
Fedora 8ÏÂÓÃYum°²×°Apache+PHP+MySQL»·¾³
fedora8 ÓÃyumÀ´¹ÜÀí°²×°Apache+PHP+MysqlµÄ»ù±¾°²×°¡£
1. °²×°Apahce, PHP, Mysql, ÒÔ¼°phpÁ¬½Ómysql¿â×é¼þ¡£
yum -y install httpd php mysql mysql-server
php-mysql
centos°²×°php²å¼þ¾ÍÊÇy ......

ΪphpÌṩssh2µÄÖ§³Ö

Ô­Ìù£ºhttp://www.haw-haw.org/node/150
ÓÃÀ´ÔÚphp³ÌÐòÀï·½±ãµÄÁ¬µ½Ô¶³ÌÖ÷»ú
Ö´ÐгÌÐò
²¢È¡»Ø½á¹û
Ê×ÏÈ£¬ÏµÍ³ÐèÒªÒѾ­×°ÓÐopensslºÍopenssl-devel°ü
rpm -qa | grep openssl
È»ºó£¬°²×°libssh2
µ±ÏÂÀ´Ô´´úÂëºó
./configure && make all install
ÔÙÈ»ºó£¬°²×°PECL/ssh2
¿ÉÒÔÓÃÃüÁîpear install ssh2
(ÑÛÇ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ