PHP»º´æ´úÂë
PHP»º´æ´úÂë
ºÃµÄÒ³Ã滺´æ´úÂ룬¿ÉÒÔ¼õÇáCPUºÍMYSQL¸ºµ£¡£Ê¹ÓÃÇ°£¬ÏÈÔÚ¸ùĿ¼´´½¨“cache”Îļþ¼Ð£¬È»ºóÔËÐÐ1.php£¬µÚÒ»´ÎÔËÐк͵ڶþ´ÎÔËÐÐËٶȲîÒìºÜ´ó¡£»¶ÓÊìϤPHPµÄÅóÓÑʹÓúÍÌáÒâ¼û¡£
ʹÓ÷½·¨:(Çë±£´æΪtemp.php)
<?php
include('arrcache.php');
$cache = new ArrCache('cache',5,'txt');
for ($i=0;$i<5;$i++)
{
echo $i;
sleep(1);
}
$cache->endCache();
?>
Ô´´úÂë:(Çë±£´æΪ'arrcache.php')
<?php
/*
*
* »º´æÍøÒ³ÄÚÈÝ£¬¼õÇá·þÎñÆ÷CPU¸ººÉ£¬Ê¹Óüò±ã¡¢Áé»î¡£
* ±¾³ÌÐòÖ÷Òª¶ÔMYSQLµÄselect²Ù×÷½øÐÐÓÅ»¯£¬»¹Óв¿·ÖС͵Àà³ÌÐò¡£
* ±ÈÈçÔÚ°Ù¶ÈËÑË÷Ò»¸ö²»³£¼ûµÄ¹Ø¼ü×Ö£¬µÚÒ»´ÎËÑË÷Ëٶȷdz£Âý£¬“ÕÒµ½Ïà¹ØÍøÒ³181ƪ£¬ÓÃʱ0.426Ãë”
* ÄÇôÔÙËÑË÷Ò»´Î£¬¾Í»á±ä³É“ÕÒµ½Ïà¹ØÍøÒ³181ƪ£¬ÓÃʱ0.001Ã딡£
* ±¾³ÌÐò¾ÍÊÇʹÓÃÁËÀàËƵķ½·¨»º´æÊý¾Ýµ½·þÎñÆ÷Ó²ÅÌ£¬¼õÇáCPUºÍÊý¾Ý¿â¸ººÉ¡£
* Çë¸ù¾ÝÄúÒ³ÃæÈÕ·ÃÎÊÁ¿À´É趨»º´æʱ¼ä¡£
* ʹÓÃÇ°£¬Ò»¶¨ÏÈ´´½¨ºÃ»º´æĿ¼¡£
*
* ×¢Ò⣺
*
* ²»ÊÇËùÓÐÒ³Ã涼ÐèҪʹÓñ¾³ÌÐò¡£
* »º´æÎļþ»áÕ¼ÓÃÒ»¶¨Ó²Å̿ռ䡣
* ÀýÈçÐèÒª¶ÔÊý¾Ý¿â½øÐÐinster¡¢delete¡¢update²Ù×÷µÄÒ³Ã治ҪʹÓã¬select¿ÉÒÔ¡£
* mail()¡¢fwrite()µÈº¯Êý£¬½«²»²úÉúÈκÎ×÷Óá£
* Çë²»Òª½«»º´æʱ¼äÉèÖõÃ̫С£¨Ð¡ÓÚ5Ã룩£¬ÄÇÑù²»»á¼õÇḺºÉ
* Èç¹ûÄãµÄÒ³Ãæ·ÃÎÊÁ¿²»Ì«¸ß£¬Ò²²»ÒªÊ¹Óñ¾´úÂë¡£
*
* ʹÓ÷½·¨£º
*
* include('arrcache.php');//±ØÐëÔÚÎļþ×ʼ´¦°üº¬±¾Ò³
* $cache = new ArrCache('cache');//ÉèÖûº´æÎļþ¼Ð
* ……
* ……
* ……//´úÂë
* $cache->endCache();//ÔÚÎļþ×îºóдÈë
*
* ˵Ã÷:
*
* class ArrCache(stri
Ïà¹ØÎĵµ£º
Ò»¡¢ °²×°Apache
¡¡¡¡ÏÂÃ棬ÎÒÃÇÊ×ÏȽéÉÜÈçºÎ°²×°Apache¡£¾ßÌå°²×°ÃüÁîÈçÏÂËùʾ£º
¡¡¡¡$ sudo apt-get install apache2
¡¡¡¡È»ºóÔËÐÐApache£¬ÃüÁîÈçÏÂËùʾ£º
¡¡¡¡$ sudo /etc/init.d/apache2 restart
¡¡¡¡ApacheÔÚ°²×°Æڼ佫»áн¨Ò»¸öĿ¼£º/var/www£¬¸ÃĿ¼ÊǸ÷þÎñÆ÷Öдæ·ÅÎĵµµÄ¸ùĿ¼¡£Ö»ÒªÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÊäÈë ......
<?
//
½¨Á¢Ò»¸öÖ¸ÏòÐÂCOM×é¼þµÄË÷Òý
$word
=
new
COM(”word
.
application”) or
die
(”Can
'
t start Word!”);
// ÏÔʾĿǰÕýÔÚʹÓõÄWordµÄ°æ±¾ºÅ
//echo “Loading Word, v. {$word->Version}<br>”;
// °ÑËüµÄ¿É¼ûÐÔÉèÖÃΪ0£¨¼Ù£©£¬Èç¹ûÒ ......
Ϊ PHP Ìí¼ÓÀ©Õ¹¿âÊÇÒ»¼þ¼òµ¥µÄÊÂÇé¡£²»¹ýÊ×ÏÈÄã×îºÃ»áÒ»µãµãC/C++±à³Ì¼¼Êõ£¬²¢ÇÒ¶ÔMakefileÓÐÒ»¶¨µÄÁ˽⡣
ÒÔÏÂÊÇÔÚ Linux ϵÄÒ»¸ö¼òµ¥Àý×Ó£º
Ê×ÏÈ£¬½øÈë php Ô´´úÂëĿ¼£¨¼ÙÉèΪ PHP_SRC£¬ÒÔÏÂͬ£©£¬Ê¹Óà php ×Ô´øµÄ ext_skel ¹¤¾ßÉú³ÉÒ»¸öÐÂÀ©Õ¹ mk4php£º
cd PHP_SRC/etc;
./ext_skel --extname=mk4php
Õý³£Ç ......
IPV4 ¿ÉÒÔ¿´×ö4¸ö256½øÖƵÄÊý×Ö, ¿ÉÒÔ°´³£¹æµÄ½øÖÆת»»»»Ëã³ÉÊ®½øÖÆ.
Èç 192.168.1.1 »»Ëã³É10½øÖÆ:
192*256*256*256 + 168*256*256+1*256+1
Æäʵ¼ÆËã»ú¸üÉó¤ÒÆλºÍÓë»òÔËËã. ¿ÉÒԸĽøËã·¨ÈçÏÂ.
IP ת³¤ÕûÐÍ
public ipToInt($sIP)
{
$aIP = explode('.',$sIP);
$iIP = ($aIP[0] << 24) | ($aIP[1] ......
PHPÖ§³Ö8ÖÖÔʼÀàÐÍ£¬ÆäÖаüÀ¨£º
4ÖÖ±êÁ¿ÀàÐÍ£ºboolean(²¼¶ûÐÍ)¡¢integer(ÕûÐÍ)¡¢float(¸¡µãÐÍ)¡¢string(×Ö·ûÐÍ)£»
2ÖÖ¸´ºÏÀàÐÍ£ºarray(Êý×é)¡¢object(¶ÔÏó)£»
2ÖÖÌØÊâÀàÐÍ£ºresource(×ÊÔ´)¡¢NULL
Äú¿ÉÄÜ»¹»á¶Áµ½Ò»Ð©¹ØÓÚ“Ë«¾«¶È£¨double£©”ÀàÐ͵IJο¼¡£Êµ¼ÊÉÏ double ºÍ float ÊÇÏàͬµÄ£¬ÓÉÓÚһЩÀúÊ·µÄÔ ......