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

APC(Alternative PHP Cache)

APCÊÇÒ»ÖÖphpµÄ»º´æ½â¾ö·½°¸,ĿǰÒÔpecl·½Ê½·¢²¼,ÓÐÏûϢ˵½«»á³öÏÖÔÚphp6°æ±¾µÄÄÚºË.
Ò».°²×°·½·¨
1)´Óhttp://pecl.php.net/package/apcÏÂÔØÏàÓ¦°æ±¾
2)½âѹ
3)½øÈëÔ´ÂëĿ¼
4)Ö´ÐÐphp°²×°Ä¿Â¼ÏµÄbin/phpize
5)./configure --enable-apc --enable-apc-mmap --with-apxs=path-to-apache/bin/apxs --with-php-config=path-to-php/bin/php-config
6)make && make install
7)½«Éú³ÉµÄapc.so¼ÓÔØµ½php.ini(extesion=apc.so,×¢Òâextension_dirµÄÉèÖÃ)
Ò»°ãµØ,±àÒëÉú³ÉµÄ.so»áÔÚphp°²×°Â·¾¶µÄlib/php/extensionsÏÂ
8)ÖØÆô,apache
дһ¸öphpinfo¿´¿´
×¢:windowsÏÂ,Ö»Òªµ½http://snaps.php.net/µÄÏàÓ¦·ÖÖ§ÏÂÏÂÔØphp_apc.dll,ÔÙÔÚphp.iniÖмÓÔØ¼´¿É
¶þ.Ó÷¨
apcµÄÓ÷¨±È½Ï¼òµ¥,Ö»Óм¸¸öº¯Êý,ÁоÙÈçÏÂ
apc_clear_cache() Çå³ýapc»º´æÄÚÈÝ
ĬÈÏ(ÎÞ²ÎÊý)ʱ,Ö»Çå³ýϵͳ»º´æ,ÒªÇå³ýÓû§»º´æ,ÐèÓÃ'user'²ÎÊý
apc_define_constants ( string key, array constants [, bool case_sensitive] )
½«Êý×éconstantsÒÔ³£Á¿¼ÓÈ뻺´æ
apc_load_constants (string Key)
È¡³ö³£Á¿»º´æ
apc_store ( string key, mixed var [, int ttl] )
ÔÚ»º´æÖб£´æÊý¾Ý
apc_fetch ( string key )
»ñµÃapc_store±£´æµÄ»º´æÄÚÈÝ
apc_delete ( string key )
ɾ³ýapc_store±£´æµÄÄÚÈÝ
ÍêÕûÀý×ÓÈçÏÂ:
<?php
//apc test
//constants
$constants = array('APC_FILE'   => 'apc.php', 'AUTHOR'   => 'tim');
apc_define_constants('numbers', $constants);
apc_load_constants('numbers');
echo 'APC_FILE='.APC_FILE.'<br>';
echo 'AUTHOR='.AUTHOR.'<br>';
//variable
if(!apc_fetch('time1')) apc_store('time1', time());
if(!apc_fetch('time2')) apc_store('time2', time(),2); //set ttl
echo 'time1:'.apc_fetch('time1').'<br>';
echo 'time2:'.apc_fetch('time2').'<br>';
//object
class a{
     function b(){return 'i am b in class a';}
}
apc_store('obj',new a());
$a = apc_fetch('obj');
echo $a->b();
echo '<br>';
//array
$arr = array('a'=>'i am a','b'=>'i am b');
apc_store('arr',$arr);
$apc_arr = apc_fetch('arr');
print_r($apc_arr);
?>
Ìáʾ:Äã¿ÉÒÔË¢ÐÂÒ»ÏÂ,¿´tt


Ïà¹ØÎĵµ£º

php variable circular reference

 
Php Variable Circular References

Circular-references has been a long outstanding issue with PHP. They are
caused by the fact that PHP uses a reference counted memory allocation
mechanism for its internal variables. This causes problems for longer
running scripts (such as an Applicatio ......

PHPµÄcURL¿â¹¦Äܼò½é£º×¥È¡ÍøÒ³£¬POSTÊý¾Ý¼°ÆäËû

ʹÓÃPHPµÄcURL¿â¿ÉÒÔ¼òµ¥ºÍÓÐЧµØÈ¥×¥ÍøÒ³¡£ÄãÖ»ÐèÒªÔËÐÐÒ»¸ö½Å±¾£¬È»ºó·ÖÎöÒ»ÏÂÄãËùץȡµÄÍøÒ³£¬È»ºó¾Í¿ÉÒÔÒÔ³ÌÐòµÄ·½Ê½µÃµ½ÄãÏëÒªµÄÊý¾ÝÁË¡£ÎÞÂÛ
ÊÇÄãÏë´Ó´ÓÒ»¸öÁ´½ÓÉÏÈ¡²¿·ÖÊý¾Ý£¬»òÊÇȡһ¸öXMLÎļþ²¢°ÑÆäµ¼ÈëÊý¾Ý¿â£¬ÄÇžÍÊǼòµ¥µÄ»ñÈ¡ÍøÒ³ÄÚÈÝ£¬cURL
ÊÇÒ»¸ö¹¦ÄÜÇ¿´óµÄPHP¿â¡£±¾ÎÄÖ÷Òª½²ÊöÈç¹ûʹÓÃÕâ¸öPHP¿â¡£
ÆôÓÃ ......

php mysql»Ø¹öʾÀý

Ê×ÏÈ£¬½¨InnoDBÀàÐÍµÄ±í£¬²ÅÄÜÖ§³ÖÊÂÎñ
$handler = mysql_connect('localhost', '', '');
mysql_select_db('test');
mysql_query('SET AUTOCOMMIT=0'); // ÉèÖÃΪ²»×Ô¶¯Ìá½»²éѯ
mysql_query('START TRANSACTION'); // ¿ªÊ¼²éѯ£¬ÕâÀïÒ²¿ÉÒÔʹÓÃBEGIN
mysql_query("INSERT INTO users VALUES ('ccc')");
mysql_query( ......

php Öеĵ¥ÒýºÅ Ë«ÒýºÅ ·´ÒýºÅµÄ×÷ÓÃ

×Ö·û´®µÄд·¨
×Ö·û´®ÒÔµ¥¡¢Ë«»òµ¹ÒýºÅΧס·Ö±ðÓв»Í¬µÄÒåÒâ¡£
µ¥ÒýºÅ
ÀýÈ磺
$str = 'An apple a day keeps the docter away.'
µ±×Ö·û´®³öÏÖ ' ·ûºÅʱ£¬±ØÐë¼ÓÉÏ£º
'I'm wing'
Ó¦¸Ä³É£º
'I'm wing'
²Å¶Ô£¬ÆäÖÐ ' ¼´³ÆÎªÌøÍÑ×Ö·û (escape character)¡£
Ë«ÒýºÅ
ÒÔË«ÒýºÅΧסµÄ×Ö·û´® PHP »á¶Ô¸Ã×Ö·û´®× ......

phpÖеÄ×Ö·û´®Á¬½Ó

// ¶¨ÒåÒ»¸öбäÁ¿
$test = "hello";
//  .  ×Ö·û´®Á¬½Ó·û
echo $test.".world"     // hello.world
 echo "$test.world"     // "" ÖеıäÁ¿½«±»½âÎö³ÉÏàÓ¦µÄÖµ
             &nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ