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À´Íê³ÉÕâÒ»Çкܼòµ¥£¬µ«ÐèҪעÒâµÄÊÇÈç¹ûÏëÔÚÒÔºóµÄÒ³ÃæÖж¼ÄÜÈ·ÈÏÓû§Éí·Ý¡£
µÚÒ»²½ÊÇ×öÒ»¸öµÇ¼µÄÒ³Ãæ¡£
µÚ¶þ²½¿ªÊ¼µÇ¼ºóµÄÈ·ÈϳÌÐòµÄÉ ......
ÕâƪÎÄÕµijö·¢µãÊÇÎÒ¶Ô²å¼þ»úÖÆ
µÄÀí½â£¬¼°ÆäÔÚPHPÖеÄʵÏÖ¡£´Ë·½°¸½öÊDzå¼þ»úÖÆÔÚPHPÖеÄʵÏÖ·½°¸Ö®Ò»£¬Ð´ÏÂÀ´ºÍ´ó¼Ò·ÖÏí£¬»¶Ó´ó¼ÒÒ»ÆðÌÖÂÛ¡£
²å¼þ
£¬Ò༴Plug-in£¬ÊÇÖ¸Ò»ÀàÌض¨µÄ¹¦ÄÜÄ£¿é£¨Í¨³£ÓɵÚÈý·½¿ª·¢ÕßʵÏÖ£©£¬ËüµÄÌصãÊÇ£ºµ±ÄãÐèÒªËüµÄʱºò
¼¤»îËü£¬²»ÐèÒªËüµÄʱºò½ûÓÃ/ɾ³ýËü£»ÇÒÎÞÂÛÊǼ¤»î»¹ÊǽûÓö¼²»Ó° ......
ÏÂÃæÕâһС¶Î“ÁÓÖÊ”µÄPHP´úÂëÊÇÒ»µÀ¼ò»¯Á˵IJâÊÔÌâ¡£ÕâÖÖÎÊÌâ¾ÍÏñÔÚÎÊ£ºÄã¸ÃÔõÑùÓÅ»¯Õâ¶Î´úÂ룿
<?
echo(”<p>Search results for query: ” .
$_GET['query'] . “.</p>”);
?>
¡¡¡¡Õâ¶Î´úÂëµÄÖ÷ÒªÎÊÌâÔÚÓÚËü°ÑÓû§Ìá½»µÄÊý¾ÝÖ±½ÓÏÔʾµ½ ......
php google baidu ·ÖÒ³
<?php
/**
×÷Õߣº
äìÏ沩¿Í http://blog.csdn.net/fkedwgwy
ʱ¼ä£º
2009-11-26
php¼¼ÊõȺ£º
37304662
ʹÓ÷½·¨£º
include_once'Pager.class.php';
$pager=new Pager();
if(isset($_GET['page']))
$pager->setCurrentPage($_GET['page']);
else
$pager->setCurrentPage(1);
......