phpÓëWebService½»»¥
WebService¼ò½é
Ò»£® ¸ÅÊö
Ä¿Ç°½øÐÐWeb ServiceͨÐÅÓÐÁ½ÖÖÐÒé±ê×¼£¬Ò»ÖÖÊÇXML-RPC£¬ÁíÍâÒ»ÖÖÊÇSOAP¡£
1. XML-RPC±È½Ï¼òµ¥£¬³öÏÖʱ¼ä±È½ÏÔ磻
2. SOAP±È½Ï¸´ÔÓ£¬Ö÷ÒªÊÇһЩÐèÒªÎȶ¨¡¢½¡×³¡¢°²È«²¢ÇÒ¸´ÔÓ½»»¥µÄʱºòʹÓá£
PHPÖм¯³ÉÁËXML-RPCºÍSOAPÁ½ÖÖÐÒéµÄ·ÃÎÊ£¬¶¼ÊǼ¯ÖÐÔÚxmlrpcÀ©Õ¹µ±ÖС£ÁíÍ⣬ÔÚPHPµÄPEARÖУ¬²»¹ÜÊÇPHP 4»¹ÊÇPHP 5£¬¶¼ÒѾĬÈϼ¯³ÉÁËXML-RPCÀ©Õ¹£¬¶øÇÒ¸ÃÀ©Õ¹¸úxmlrpcÀ©Õ¹Î޹أ¬Äܹ»¶ÀÁ¢ÊµÏÖXML-RPCµÄÐÒé½»»¥£¬Èç¹ûûÓÐxmlrpcÀ©Õ¹£¬½¨ÒéʹÓÃPEAR::XML-RPCÀ©Õ¹¡£
¶þ£® °²×°xmlrpcÀ©Õ¹
Èç¹ûϵͳÖÐûÓа²×°xmlrpcµÄphpÀ©Õ¹£¬ÄÇôÇëÕýÈ·°²×°¡£
1. ÔÚWindowsƽ̨Ï£¬Ê×ÏÈ°ÑPHP°²×°Ä¿Â¼ÏµÄÀ©Õ¹php_xmlrpc.dll·Åµ½C:\Windows»òÕßC:\WinntĿ¼Ï£¬(PHP4µÄÀ©Õ¹ÔÚC:\php\extensionsĿ¼ÖУ¬PHP5µÄÀ©Õ¹ÔÚC:\php\extĿ¼ÖÐ)£¬Í¬Ê±ÔÚC:\Windows\php.ini»òÕßC:\Winnt\php.iniÖаÑextension=php_xmlrpc.dllÇ°ÃæµÄ·ÖºÅ";"È¥µô£¬È»ºóÖØÆôWeb·þÎñÆ÷ºó²é¿´phpinfo()ÓÐûÓÐXML-RPCÏîÄ¿¾ÍÄܹ»È·¶¨ÊÇ·ñÒѾÕýÈ·°²×°xmlrpcÀ©Õ¹¡£
2. ÔÚUnix/Linuxƽ̨Ï£¬Èç¹ûûÓа²×°xmlrpcÀ©Õ¹£¬ÇëÖØбàÒëPHP£¬ÔÚconfigureµÄʱºòÇë¼ÓÈë --with-xmlrpc Ñ¡ÏȻºó²é¿´phpinfo()¿´ÊÇ·ñÕý³£°²×°xmlrpc¡£
Èý£® XML-RPCʵ¼ù
·þÎñÆ÷¶ËʹÓÃxmlrpc_server_create()º¯Êý²úÉúÒ»¸ö·þÎñÆ÷¶Ë£¬È»ºó°ÑÐèÒªÐèÒª±©Â¶µÄRPCµ÷ÓýӿڽøÐÐ×¢²á£¬½ÓÊÜRPC¿Í»§¶ËPOST¹ýÀ´µÄXMLÊý¾Ý£¬È»ºó½øÐд¦Àí£¬´¦Àí½á¹ûͨ¹ýXMLµÄÐÎʽÏÔʾ¸ø¿Í»§¶Ë¡£
´úÂëÈçÏ£º rpc_server.php
/**
* º¯Êý£ºÌṩ¸øRPC¿Í»§¶Ëµ÷Óõĺ¯Êý
* ²ÎÊý£º
* $method ¿Í»§¶ËÐèÒªµ÷Óõĺ¯Êý
* $params ¿Í»§¶ËÐèÒªµ÷Óõĺ¯ÊýµÄ²ÎÊýÊý×é
* ·µ»Ø£º·µ»ØÖ¸¶¨µ÷Óýá¹û
*/
function rpc_server_func($method, $params) {
$parameter = $params[0];
if ($parameter == "get")
{
$return = ''This data by get method'';
}
else
{
$return = ''Not specify method or params'';
}
return $return;
}
//²úÉúÒ»¸öXML-RPCµÄ·þÎñÆ÷¶Ë
$xmlrpc_server = xmlrpc_server_create();
//×¢²áÒ»¸ö·þÎñÆ÷¶Ëµ÷Óõķ½·¨rpc_server£¬Êµ¼ÊÖ¸ÏòµÄÊÇrpc_server_funcº¯Êý
xmlrpc_server_register_method($
Ïà¹ØÎĵµ£º
PHPÊý¾ÝÀàÐÍת»»Ï¸½Ú
1¡¢Êý×Ö£¨ÕûÐκ͸¡µãÐÍÖ®¼ä¿ÉÒÔÏ໥ת»¯£©
ÕûÐÎת»»Îª¸¡µãÐÍ£ºÓÉÓÚ¸¡µãÐ͵ľ«¶È·¶Î§Ô¶´óÓÚÕûÐΣ¬ËùÒÔת»»ºóµÄÊýÖµ¾«¶È²»»á¸Ä±ä¡£
¸¡µãÐÍת»»ÎªÕûÐΣº½²×Ô¶¯ÉáÆúСÊ÷²¿·Ö£¬Ö»±£ÁôÕûÊý²¿·Ö¡£×¢£ºÈç¹ûÒ»¸ö¸¡µãÐͳ¬¹ýÕûÊýÈ¡ÖµµÄÓÐЧ·¶Î§£¬Æä½á¹û½«ÊÇÎÞ·¨È·¶¨µÄ£¨ÕûÊýµÄ×î´óÖµÔ¼ÊÇ2.147e9£©¡£
¡¾Ê¾Àý¡ ......
PHP±äÁ¿µÄ±äÁ¿£¬¼´¿É±ä±äÁ¿
¿É±ä±äÁ¿µÄ¸ÅÄͨ¹ý»ñÈ¡Ò»¸ö±äÁ¿µÄÖµ×öΪÁíÍâÒ»¸ö±äÁ¿µÄÃû³ÆÀ´²Ù×÷±äÁ¿£¬¾ÍÊÇ¿ÉÒÔ±äÁ¿¡£
¡¾Ê¾Àý¡¿
Îı¾²é¿´¸´ÖÆ´úÂë´òÓ¡¹ØÓÚ
<?php
$a = 'hello'; //ÆÕͨ±äÁ¿
$$a = ' ......
<?php
/*
* Created on 2009-10-23
* ·Ö×ÓÈçÃÎo(╯¡õ╰)o
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
class people
{
private $name;
pu ......
ÔÎÄ£ºhttp://www.phpx.com/tech/php/2009-01-29/286.html
ÏÂÃæÊǽØÈ¡µÃapache·µ»Ø¿Í»§¶ËµÄÍ·
---------
Last-Modified: Fri, 26 Jan 2007 01:53:34 GMT
& ......
·þÎñÆ÷½Å±¾ÓëJavascriptµÄÁ½ÖÖ½»»¥·½Ê½(ÒÔphpΪÀý)
ÒýÓÃ:http://www.knowsky.com/1014.html
ÔÚÍøÒ³ÖÆ×÷¹ý³ÌÖÐÔõÑùÔÚ²»Ë¢ÐÂÒ³ÃæµÄÇé¿öÏÂʹǰ̨ҳÃæºÍºǫ́CGIÒ³Ãæ±£³Ö½»»¥Ò»Ö±ÊǸöÎÊÌâ¡£ÕâÀï½éÉÜÁ½¸ö·½·¨¡£
·½·¨Ò»£ºÍ¨¹ýCookie½»»¥¡£
Ò»¹²ÊÇÈý¸öÎļþ£¬·Ö±ðΪ£ºindex.htm,action.php,main.htm
ÔÀíΪǰ̨ҳÃæmain.htmºÍº ......