PHP SOAP À©Õ¹Ïê½â
PHP SOAP À©Õ¹
SOAP µÄÈ«³ÆΪ¼òµ¥¶ÔÏó·ÃÎÊÐÒé (Simple Object Access Protocol)¡£ËüÊÇÒ»ÖÖ»ùÓÚ XML µÄ£¬¿ÉÀ©Õ¹µÄͨÐÅÐÒé¡£SOAP ÌṩÁËÒ»ÖÖ±ê×¼£¬Ê¹µÃÔËÐÐÔÚ²»Í¬Æ½Ì¨Éϲ¢Ê¹Óò»Í¬µÄ±à³ÌÓïÑÔ±àдµÄÓ¦ÓóÌÐò¿ÉÒÔ»¥Ïà½øÐÐͨÐÅ¡£SOAP µÄ¿ÉÀ©Õ¹ÐÔºÍƽ̨ÎÞ¹ØÐÔʹµÃËü±»¹ã·ºÓÃ×÷ Web ·þÎñµÄͨÐÅÐÒé¡£
ÓÉÓÚ Java ÓïÑÔÌṩÁË¶Ô SOAP µÄÁ¼ºÃÖ§³Ö£¬Í¨³£»ùÓÚ Web ·þÎñµÄÓ¦ÓóÌÐòʹÓà Java ÓïÑÔ±àд¡£¶ÔÓÚ¹ã´óµÄ PHP ³ÌÐòÔ±À´Ëµ£¬¿ÉÄÜ»áÓÐÒ»µãССµÄ²»Âú – PHP µÄ½ÏÔç°æ±¾¸ù±¾Ã»ÓÐ¶Ô SOAP µÄÖ±½ÓÖ§³Ö£¬Ö»ÄÜͨ¹ý PEAR(the PHP Extension and Application Repository) ÖÐµÄ SOAP ¿â»òÕßµÚÈý·½²úÆ· NuSOAP À´¿ª·¢ Web ·þÎñ¡£²»¹ý×î½üµÄ°æ±¾ÒѾ¸Ä±äÁËÕâÒ»×´¿ö¡£×Ô PHP 5 ¿ªÊ¼ÐÂÔöÁËÄÚÖÃµÄ SOAP À©Õ¹ (ext/soap)£¬´Ó´ËÎÒÃDz»ÐèÒªÏÂÔضîÍâµÄÀ©Õ¹¿â»òÊÇ´úÂë°üÀ´¿ª·¢»ùÓÚ SOAP µÄÓ¦ÓóÌÐòÁË¡£½ÓÏÂÀ´ÈÃÎÒÃÇÀ´¿´¿´ SOAP À©Õ¹Öж¼ÓÐÄÄЩÄÚÈÝ¡£
PHP 5 ÖÐµÄ SOAP À©Õ¹ (ext/soap)PHP 5 ×îÔç·¢²¼µÄ°æ±¾ 5.0.0 ÖоÍÒѾÌṩÁË SOAP À©Õ¹£¬²»¹ýµ±Ê±µÄ PHP ÊÖ²áÖÐÉùÃ÷Õâ¸öÀ©Õ¹ÊÇÊÔÑéÐÔ (experimental) µÄ¡£Êµ¼ÊÉϵ±Ê±µÄ°æ±¾ÒѾʵÏÖÁ˱ȽÏÍêÉƵŦÄÜ£¬Ò²Ã»ÓбØҪΪ´Ë¶øµ£ÐÄ¡£Ä¿Ç°Õâ¸öÀ©Õ¹»¹ÔÚ²»¶ÏµØÍêÉÆ£¬ÔçÆÚ°æ±¾ÖÐµÄ´ó²¿·Ö bug ¶¼ÒѾµÃµ½ÁËÐÞÕý£¬Ä¿Ç°×îеİ汾 (5.3.0) ÖÐÒѾÌṩÁ˱ȽÏÍêÕûµÄ¶Ô SOAP µÄÖ§³Ö£¬¶øÇÒÎÒÃÇÓÐÀíÓÉÏàÐÅ£¬ÒÔºóµÄ°æ±¾»¹»á¸üºÃ¡£
SOAP À©Õ¹¿â½á¹¹
ext/soap ÖаüÀ¨Áù¸öÔ¤¶¨ÒåµÄÀ࣬ͨ¹ýÕâЩÀ࣬ÎÒÃÇ¿ÉÒÔ´´½¨ Web ·þÎñ¶Ë (SoapServer Àà )£¬¿Í»§¶Ë (SoapClient Àà )£¬´¦Àí SOAP ÇëÇóºÍÓ¦´ð (SoapHeader, SoapParam, SoapVar Àà )£¬Õï¶Ï´íÎó (SoapFault Àà )¡£ÕâЩÀàÖ®¼äµÄÁªÏµÈçͼ 1 Ëùʾ£º
ͼ 1. SOAP À©Õ¹µÄ½á¹¹
SOAP ·þÎñÀà SoapServer
SoapServer ÀàÓÃÀ´¿ª·¢ Web ·þÎñ¶ËÓ¦ÓóÌÐò¡£Õâ¸öÀàÖаüº¬´´½¨£¬ÉèÖúͲÙ×Ý Web ·þÎñµÄº¯Êý¡£ÓÐÁ½ÖÖ·½Ê½¿ÉÒÔÏò Web ·þÎñÖÐÌí¼Ó²Ù×÷ (Operation)¡£Ò»ÖÖ·½Ê½ÊÇÖ±½ÓÌí¼ÓÒѶ¨ÒåµÄº¯Êý£¬ÁíÒ»ÖÖ·½Ê½ÊÇÌí¼ÓÒѶ¨ÒåºÃµÄÀ࣬´Ó¶ø½«¸ÃÀàµÄ¹«ÓгÉÔ±º¯ÊýÌí¼Óµ½ Web ·þÎñÖС£
ÁíÒ»¸öÐèҪ˵Ã÷µÄÌØÐÔÊÇ£¬PHP Ö§³ÖÁ½ÖÖ Web ·þÎñµÄģʽ£ºWSDL ģʽºÍ non-WSDL ģʽ£¬ÎªÁ˱ãÓÚÀí½â£¬ÎÒÃÇÊ×ÏÈ´Ó Web ·þÎñµÄÁ½ÖÖʵÏÖģʽ¿ªÊ¼ËµÆð¡£
PHP ÖÐ Web ·þÎñµÄÁ½ÖÖģʽ£ºWSDL ģʽºÍ non-WSDL ģʽ
¶ÔÓÚ Web ·þÎñÀ´Ëµ£¬Ö÷ÒªÓÐÁ½ÖÖʵÏÖģʽ – ÆõÔ¼ÏÈÐÐ (Contract First) ģʽºÍ´úÂëÏÈÐÐ (Code Fist) ģʽ¡£
ÆõÔ¼ÏÈÐÐģʽµÄ
Ïà¹ØÎĵµ£º
<?php
$start = ip2long('192.168.1.1');
$start = sprintf("%u", $start) ;
$end = ip2long('192.168.1.50');
$end = sprintf("%u", $end) ;
for ($start; $start<$end; $start++){
echo long2ip($start)."<br>";
}
?> ......
9.3 ͨ¹ýPHP²Ù×÷AccessÊý¾Ý¿â
9.3.1 Á¬½ÓAccessÊý¾Ý¿â
ÔÚPHPÖÐÁ¬½ÓAccessÓÐÈçÏÂ3ÖÖ·½Ê½¡£
£¨1£©´´½¨ÏµÍ³Êý¾ÝÔ´£¬ÓÃPHPÌṩµÄODBCº¯Êý
¼´¿É¡£
£¨2£©Í¬Ñù¿ÉÒÔʹÓÃPHPµÄODBCº¯Êý£¬µ«²»´´½¨
Êý¾ÝÔ´¡£¿ª·ÅÊý¾Ý¿âÁ¬½Ó£¨Open DateBase
Conection£¬ODBC£©ÊÇWindows Open
Server£¨¿ª·Å·þÎñ£©API£¨WOSA£©²úÆ·Ö®Ò ......
½ñÌìÅöµ½¸öÆæ¹ÖµÄÎÊÌ⣬һ¸öajaxÒ³ÃæÔÚ±¾µØ²âÊÔ·þÎñÆ÷ÔËÐÐÒ»ÇÐÕý³££¬´«µ½¹«Íø·þÎñÆ÷ÉϾÍËÀ»î˵ javascript´íÎó¡£
´ò¿ª´úÂëÒ»¿´£¬ÊÇjavascriptµÄÄÇÒ»ÐÐʹÓÃÁËÒ»¸öjsonµÄreponseText£¬DEBUGһϣ¬ÔÀ´»Ø´«Êǿյġ£
¿´¿´ºǫ́PHP£¬Ã²ËÆûʲôÎÊÌ⣨±¾À´ÒÔΪÊÇURLÎÊÌ⣩ȻºóÉÏÍøËÑһϣ¬ÔÀ´ÊÇPHPµÄjson_encodeº¯ÊýÔÚ5.2ϲÅÓÐ ......
smarty×÷ΪPHPµÄÄ£°å£¬ÊµÏÖÁËǰ̨ÃÀ¹¤Óëºǫ́Âß¼µÄ·ÖÀ롣ǰһ¶Îʱ¼ä¼òµ¥µØѧÁËһϣ¬°ÑÆä°²×°ÓÚÅäÖÃÒÔ¼°ÄÚ²¿µÄÓï·¨À´¼òµ¥×ܽáһϡ£È»ºóÒªÉè¼Æһϵç×ÓÉÌÎñϵͳ¡£
smartyѹËõ°ü½âѹºó£¬ÔÚlibsÎļþ¼ÐÏ£¬ÓÐ2¸öĿ¼ºÍ4¸öÎļþ£¬2¸öÎļþ¼Ð·Ö±ðÊÇinternalsºÍplugins£¬4¸öÎļþÒÀ´ÎÊÇdebug,smarty.class,config_file.class,smarty ......
Ò»¡¢»º´æ¼¼Êõ:
ÓÐЩÐÅÏ¢±È·½¾³£²»±äµÄ,µ«ÊÇ»¹ÊÇÄܱäµÄÐÅÏ¢·ÅÔÚ»º´æÖÐÒÔ¼Ó¿ìÏÔʾËÙ¶È,ÕâÊǺÜÓмÛÖµµÄ,ËùνµÄ»º´æ,ͨË×µÄÀí½â¾ÍÊÇһЩ±£´æÔÚ·þÎñÆ÷¶ËµÄ¹²ÓÃÐÅÏ¢.ËüÊÇÓÚ·þÎñÆ÷ͬÉúËÀµÄ,ÎÒÃÇÔÚ±£´æ»º´æµÄʱºò¿ÉÒÔÖ¸¶¨Ï´θüеÄʱ¼äµÄÅжÏ,±È·½ÒªÔÚ5·ÖÖÓ¸üÐÂÒ»´Î,¿ÉÒԼǼÉϴθüеÄʱ¼ä,ºÍµ±Ç°Ê±¼ä±È½Ï, ......