³¢ÊÔÓÃGearmanʵÏÖ·Ö²¼Ê½´¦Àí£¨PHP£©
±¾ÎÄÐèÒªÄãÒѶÔGearmanÓиö´óÖÂÁ˽⣬Èç¹û²»Öª¸Ã¶«¶«ÊǺÎÎÇë²Î¿¼Ö®Ç°Ò»Æª×ªÌûÈÕÖ¾¡¶Gearman - ·Ö²¼Ê½Ô¶³Ì¹ý³Ì´¦Àí¿ò¼Ü¡·
˳±ãÔÙÍƼöÁ½Æª²Î¿¼ÎÄÕÂ
http://hi.baidu.com/thinkinginlamp/blog/item/ff49972b9e7378f3e6cd40aa.html
£¨Ñ§Ñ§Gearman£©
http://www.ibm.com/developerworks/cn/opensource/os-php-gearman/index.html
£¨Óà Gearman ·Ö·¢ PHP Ó¦ÓóÌÐòµÄ¹¤×÷¸ºÔØ£©
¸ü¶à²Î¿¼´ó¼Ò»¹ÊÇ×Ô¼ºgoogle°É:)
±¾ÎÄÖ»¼Ç¼ÎÒʵ¼ùµÄ¹ý³ÌºÍÆäÖпÉÄÜÓöµ½µÄÎÊÌâ¡£
ÊÔÑé»·¾³£¨ÐéÄâ»ú£©£ºubuntu9.04 + PHP5.2.6
¿ªÊ¼ÁË¡£¡£¡£
ÏÈ°²×°ÈÎÎñ·Ö·¢µÄJob¶Ë
°²×°Gearman server and library£º
wget http://launchpad.net/gearmand/trunk/0.8/+download/gearmand-0.8.tar.gz
tar zxf gearmand-0.8.tar.gz
cd gearmand-0.8
./configure
sudo make
sudo
make install
Öмä¿ÉÄÜ»áÓöµ½Ð©ÎÊÌ⣺
ÔÚ./configureµÄʱºò£¬¿ÉÄÜ»á³öÏÖȱÉÙlibrariesµÄÇé¿ö£¬Ò»°ãÊÇȱÉÙlibeventºÍuuidÕâÁ½¸ö¿ª·¢°ü£¬°²×°Ö®¡£¡£¡£
sudo apt-get install libevent-dev
sudo apt-get install uuid-dev
°²×°Íê³ÉºóÔÙÖØÐÂÅäÖð²×°£¬°²×°Íê³ÉºóÖ´ÐÐ
sudo ldconfig
ÒòΪ±¾ÊÔÑéClientºÍWorker¶Ë¶¼ÓÉPHPÀ´ÊµÏÖ£¬ËùÒÔÐèÒª°²×°phpµÄgearmanÀ©Õ¹
°²×°Gearman PHP extension£º
wget http://pecl.php.net/get/gearman-0.4.0.tgz
tar zxf gearman-0.4.0.tgz
cd gearman-0.4.0
phpize
./configure
sudo make
sudo make install
Öмä¿ÉÄÜÓöµ½µÄÎÊÌ⣺
ÕÒ²»µ½phpizeÃüÁphpizeÔÚphp¿ª·¢°üÖУ¬ËùÒÔÒªÏÈ°²×°php5-dev
sudo apt-get install php5-dev
°²×°Íêºó£¬¾Í¿ÉÒÔÔÚÔ´ÂëĿ¼ÖÐÖ´ÐÐphpizeÉú³ÉÏà¹Ø°²×°ÅäÖÃÐÅÏ¢£¬½Ó×ÅÖ´ÐкóÃæµÄ./configureµÈ
make installºó£¬Ëü¸æËßÄãÒ»¸öĿ¼£¬Éú³ÉµÄgearman.so¾ÍÔÚÄÇÀï¡£
¸ù¾ÝÐèÒª¿¼µ½ÏàÓ¦PHPµÄÀ©Õ¹Ä¿Â¼ÀÒòΪÎÒÖ±½ÓÓÃϵͳĬÈÏ°²×°µÄphp£¬Ëü×Ô¶¯Éú³É¾ÍÔÚÀ©Õ¹ÖУ©
½ÓÏÂÀ´ÐÞ¸Äphp.iniÒÔʹphp¼ÓÔظÃÄ£¿é£º
php --ini
¿´ÏÂphp.iniÔÚÄÄÀsudo vim ÐÞ¸ÄÖ®£¬ÔÚÆäÖмÓÈë
extension = "gearman.so"
È»ºó£¬¿ªÊ¼±àдclientºÍworker¶Ë
client.php
<?php
$client= new GearmanClient();
$client->addServer("127.0.0.1", 4730);
print $client->do("title", "Linvo");
print "\n";
?>
worker.php
<?php
$worker= new GearmanWorker();
$worker->addServer("127.0.0.1", 4730);
$worker->addF
Ïà¹ØÎĵµ£º
ºÚ¿ÍÈëÃż¼ÊõÖ®php+mysql×¢ÉäÓï¾ä¹¹Ô죺
Ò».Ç°ÑÔ£º
²âÊÔ°æ±¾ÐÅÏ¢£ºOkphp BBS v1.3 ¿ªÔ´°æ
ÓÉÓÚPHPºÍMYSQL±¾ÉíµÃÔÒò,PHP+MYSQLµÄ×¢ÉäÒª±ÈaspÀ§ÄÑ£¬ÓÈÆäÊÇ×¢ÉäʱÓï¾äµÄ¹¹Ôì·½Ãæ¸üÊǸöÄѵ㣬±¾ÎÄÖ÷ÒªÊǽè¶ÔOkphp BBS v1.3һЩÎļþµÃ¼òµ¥·ÖÎö£¬À´Ì¸Ì¸php+mysql×¢ÉäÓï¾ä¹¹Ô췽ʽ£¬Ï£Íû±¾ÎĶÔÄãÓеã°ïÖú¡£
¡¡¡¡ÉùÃ÷£ºÎÄÕÂËùÓ ......
»¥ÁªÍøµÄ½ñÌ죬AJAXÒѾ²»ÊÇʲôİÉúµÄ´Ê»ãÁË¡£ËµÆðAJAX£¬¿ÉÄÜ»áÁ¢¼´ÏëÆðÒòRSS¶øÐËÆðµÄXML¡£XMLµÄ½âÎö£¬¿ÖÅÂÒѾ²»ÊÇʲôÄÑÌâÁË£¬ÌرðÊÇPHP5£¬´óÁ¿µÄXML½âÎöÆ÷µÄÓ¿ÏÖ£¬Èç×îÇáÁ¿¼¶µÄSimpleXML¡£²»¹ý¶ÔÓÚAJAXÀ´Ëµ£¬XMLµÄ½âÎö¸üÇãÏòÓÚǰ̨JavascriptµÄÖ§³Ö¶È¡£ÎÒÏëËùÓнâÎö¹ýXMLµÄÈË£¬¶¼»áÒòÊ÷ºÍ½Úµã¶øÍ·´ó¡£²»¿É·ñÈÏ£¬XMLÊÇºÜ ......
http://linux.sheup.com/linux/linux4646.htm
GB2312->UTF-8 ת»»º¯Êý
ÒÔÏÂÊÇÒ»¶Îgb2312 -> UTF-8 µÄº¯Êý£¬Î÷Î÷£¬ÎÒ³ÁË
unicode -> UTF-8 µÄËã·¨£¬ËùÒÔʵ¼Ê±ÈGB2312->unicode
û¶à¶àÉÙ¶«Î÷,Çë´ó¼Ò×¢Òâµ÷ÓÃgb2utf8()ʱ²»ÄÜÖÐÓ¢ÎÄ»ìÓÃ
³ÌÐòÐèÒªµÄGB2312.txtÎļþ
gb2utf8.php
//Program writen by s ......
/*
author: yangyu@sina.cn
description: ½»»»Êý×éÖÐÁ½¸öÔªËصÄλÖã¬ÔªËØ°üÀ¨keyºÍvalue£¬¾ßÌåÓ÷¨¼ûÏÂÃæµÄÀý×Ó
*/
$arr = array(11=>'a',22=>'b',33=>'c',44=>'d');
$res = array_exchange($arr, 11 ,33);
//example:
echo '<pre>';print_r ($res);echo '</pre>';
function array_excha ......