NuSoap½éÉÜ (phpµ÷ÓÃwebservice)(תÔØ)
http://hi.baidu.com/honfei/blog/item/5e992bfb2704542b4f4aea1a.html
NuSoap½éÉÜ (phpµ÷ÓÃwebservice)
2009Äê07ÔÂ04ÈÕ ÐÇÆÚÁù 09:41
NuSOAP ÊÇ PHP »·¾³Ï嵀 WEB ·þÎñ±à³Ì¹¤¾ß£¬ÓÃÓÚ´´½¨»òµ÷Óà WEB ·þÎñ¡£ËüÊÇÒ»¸ö¿ªÔ´Èí¼þ£¬µ±Ç°°æ±¾ÊÇ 0.7.2 £¬Ö§³Ö SOAP1.1 ¡¢ WSDL1.1 £¬¿ÉÒÔÓëÆäËûÖ§³Ö SOAP1.1 ºÍ WSDL1.1 µÄϵͳ»¥²Ù×÷¡£ NuSOAP ÍêÈ«ÓÉPHPÓïÑÔ±àд£¬ÓÉһϵÁÐ PHP Àà×é³É£¬²»ÐèÒªÀ©Õ¹¿âµÄÖ§³Ö£¬ÕâÖÖÌØÐÔʹµÃ NuSOAP ¿ÉÒÔÓÃÓÚËùÓÐµÄ PHP »·¾³£¬²»ÊÜ·þÎñÆ÷°²È«ÉèÖõÄÓ°Ïì¡£
1. NuSOAP µÄ»ñÈ¡ºÍ°²×°
NuSOAP ÏîÄ¿½¨Á¢ÔÚ SourceForge ÉÏ£¬ÍøÂçµØÖ·ÊÇ£º http://sourceforge.net/projects/nusoap/ »ò http://dietrich.ganx4.com/nusoap£¬ÕâÀ¿ÉÒÔÏÂÔص½ NuSOAP µÄ×îеİ汾¡£
NuSOAP µÄ°²×°±È½Ï¼òµ¥£¬°ÑÏÂÔØµÄ NuSOAP µÄÎļþ¿½±´µ½·þÎñÆ÷ÉÏ£¬¿ÉÒÔ·ÅÔÚ¶ÀÁ¢µÄĿ¼ÀҲ¿ÉÒÔÓë³ÌÐò´úÂë·ÅÔÚÏàͬµÄĿ¼ÀֻҪÄãµÄ PHP ´úÂëÄܹ»·ÃÎʵ½ÕâЩÎļþ¾Í¿ÉÒÔÁË¡£
±¾ÎĵIJâÊÔ»·¾³»ùÓÚ PHP4.3.2 ºÍ NuSOAP 0.7.2 °æ±¾£¬ NuSOAP °²×°ÔÚ WEB Ŀ¼“ /nusoap ”ÀÓÐÁ½¸ö×ÓĿ¼£¬ lib ºÍ samples ¡£ÆäÖУ¬ lib Ŀ¼Ï´æ·Å NuSOAP µÄËùÓÐÔ´´úÂëÎļþ£¬ samples Ŀ¼ÏÂÊÇNuSOAP¿ª·¢Ð¡×éÌṩһЩµÄÀý×Ó¡£²âÊÔÎļþ´æ·ÅÔÚ WEB Ŀ¼“ /nusoap ”Àï¡£
2. NuSOAP µÄʹÓÃ
NuSOAP ÓÉÒ» PHP µÄÀà×é³É£¬ÆäÖÐ×î³£Óõ½µÄÊÇÀàsoap_serverºÍÀàsoalclient¡£Ààsoap_server ÓÃÓÚ´´½¨ WEB ·þÎñ£¬ÀàsoapclientÔÚ·ÃÎÊWEB·þÎñʱ»áÓõ½¡£
2.1 Ò»¸ö¼òµ¥µÄÀý×Ó£º Hello World
Õâ¸öÀý×Ó½«ÀûÓà NuSOAP ´´½¨Ò»¸ö¼òµ¥µÄ WEB ·þÎñ£¬²¢ÀûÓà NuSOAP ´´½¨Ò»¸ö¿Í»§¶Ë³ÌÐò£¬µ÷ÓÃÕâ¸ö·þÎñ¡£Õâ¸ö·þÎñΨһµÄ¹¦ÄܾÍÊÇÏò¿Í»§¶Ë·µ»ØÒ»¸ö×Ö·û´®“ Hello World ”¡£Ê×ÏÈ£¬´´½¨ WEB ·þÎñ³ÌÐò´úÂëÎļþ“ /nusoap/nusoap_server1.php ”£º
//°Ñ NuSOAP µÄÔ´Îļþ°üº¬µ½µ±Ç°µÄ´úÂëÎļþÀï
<?php
require_once("lib/nusoap.php");
//¶¨Òå·þÎñ³ÌÐò
function hello() {
return 'Hello World!';
}
//³õʼ»¯·þÎñ¶ÔÏó , Õâ¸ö¶ÔÏóÊÇÀà soap_server µÄÒ»¸öʵÀý
$soap = new soap_server;
//µ÷Ó÷þÎñ¶ÔÏóµÄ register ·½·¨×¢²áÐèÒª±»¿Í»§¶Ë·ÃÎʵijÌÐò¡£
//Ö»ÓÐ×¢²á¹ýµÄ³ÌÐò£¬²ÅÄܱ»Ô¶³Ì¿Í»§¶Ë·ÃÎʵ½¡£
$soap->register('hello');
//×îºóÒ»²½£¬°Ñ¿Í»§¶Ëͨ¹ý post ·½Ê½Ìá½»µÄÊý¾Ý£¬´«µÝ¸ø·þÎñ¶ÔÏóµÄ service ·½·¨¡£
//service ·½
Ïà¹ØÎĵµ£º
ΪÁËÓ¦¸¶Êý×ÖýÌåʵ¼ùСѧÆÚ£¬ÓÃÁ½ÈýÌìµÄʱ¼ä´Ò´ÒææµØ¼ÜÆðÀ´Ò»¸öPHPÍøÕ¾¡£ÍøÕ¾ºÜ´é£¬ÀÏʦ¸øµÄ·ÖÊýÈÃËü¿´ÆðÀ´¸ü´é¡£
×öÕâ¸öÍøÕ¾µÄÄǶÎʱ¼äÕýºÃÔÚ¿´BrooksµÄÄDZ¾¿õÊÀ¾µä¡¶ÈËÔÂÉñ»°¡·£¬Á˽âÁËÆäÖеēThe Surgical
Team”µÄ¿ª·¢Ä£Ê½£¬¾õµÃÔÚÌØÊⳡºÏÏ£¬ÕâÖÖ¿ª·¢Ä£Ê½È·Êµ»áÓµÓм«¸ßµÄ¿ª·¢Ð§ÂʺÍÍŶÓÕ½¶·Á¦¡£
Ò ......
1¡¢°²×°libeven
memcachedµÄʹÓÃÐèÒªlibevenµÄÖ§³Ö£¬ÎÒÃǵÃÏÈ×°ÉÏlibeven¡£
¹Ù·½ÍøÕ¾£ºhttp://www.monkey.org/~provos/libevent/
libevent°²×°·½Ê½±È½Ï¼òµ¥:
./configure && make
make install
¼ì²éÊÇ·ñ ÒѾ°²×°
ls -l /usr/local/lib/ | grep even
2¡¢°²×°memcached
¹Ù·½ÍøÕ¾£ºhttp://ww ......
ÕâƪÎÄÕµijö·¢µãÊÇÎÒ¶Ô²å¼þ»úÖÆ
µÄÀí½â£¬¼°ÆäÔÚPHPÖеÄʵÏÖ¡£´Ë·½°¸½öÊDzå¼þ»úÖÆÔÚPHPÖеÄʵÏÖ·½°¸Ö®Ò»£¬Ð´ÏÂÀ´ºÍ´ó¼Ò·ÖÏí£¬»¶Ó´ó¼ÒÒ»ÆðÌÖÂÛ¡£
²å¼þ
£¬Ò༴Plug-in£¬ÊÇÖ¸Ò»ÀàÌض¨µÄ¹¦ÄÜÄ£¿é£¨Í¨³£ÓɵÚÈý·½¿ª·¢ÕßʵÏÖ£©£¬ËüµÄÌصãÊÇ£ºµ±ÄãÐèÒªËüµÄʱºò
¼¤»îËü£¬²»ÐèÒªËüµÄʱºò½ûÓÃ/ɾ³ýËü£»ÇÒÎÞÂÛÊǼ¤»î»¹ÊǽûÓö¼²»Ó° ......
1.Ö±½ÓʹÓÃmysql_insert_id()»ñÈ¡ÉÏÒ»´Î²åÈëµÄÊý¾ÝµÄAUTO_INCREMENTµÄ±äÁ¿µÄ±àºÅ£¬±ÈʹÓÃmysqlÓï¾ä»ñÈ¡·½±ã¼«¶à¡£µ«×¢ÒâÒªÔÚquery()ºóÁ¢¿ÌʹÓ㬱£Ö¤Ê±¼äÕýÈ·ÐÔ£¬Èç¶àÏ̷߳ÃÎÊÊý¾Ý¿âÊDzúÉúÎó²î¡£
2.µÈºÅ×óÓÒ¸÷ÁôÒ»¿Õ¸ñ£¬ÇåÎú±ãÓÚÔĶÁ¡£
3.PHPÖУ¬µ¥Ë«ÒýºÅ¾ù¿ÉÒÔÌ×string£¬Çø±ðÔÚÓÚ£º
"this is a simple $test" = 'this i ......
ƽʱÓà htmlspecialchars() À´¹ýÂËhtml, µ«ÊÇ°ÑhtmlµÄ×Ö·ûתÒåÁË,×îºóÏÔʾ³öÀ´µÄ¾ÍÊÇhtmlÔ´´úÂë, ÀûÓÃstrip_tags()¾Í¿ÉÒÔ°Ñhtml±êÇ©È¥³ýµô.
[php]
$str = 'harryxu
‘;
echo(htmlspecialchars($str) . ‘
‘);
echo(strip_tags($str));
// output:
// harryxu
// harryxu
?>
......