php webserviceʵÀý(¼òµ¥Ò×¶®)
Ê×ÏÈ´ó¼ÒÒª¼òµ¥Á˽âÁ˺Îνwebservice£¬½ÓÏÂÀ´¾Í×öÁ½¸ö·Ç³£¼òµ¥µÄÀý
×Ó£¬webservice»¹ÊÇÌÓ²»¿ªserver¶ËÓëclient¶Ë¡£
ÎÒ²âÊԵĻ·¾³Îª£ºapache2.2.11 php5.2.10
×öÕâ¸ö²âÊÔ֮ǰ£¬ÒªÈ·ÈÏÄãµÄphpÅäÖÃÎļþÖÐÒѾ½«soapÀ©Õ¹´ò¿ª£¬¼´extension=php_soap.dll;
OK ÏÖÔÚÎÒÃÇÀ´ÌåÑéwebservice
//server¶Ë
serverSoap.php
$soap
=
new
SoapServer
(null
,
array
('uri'
=>
"http://192.168.1.179/"
));//This uri is
your SERVER ip.
$soap
->
addFunction
('minus_func'
);
//Register
the function
$soap
->
addFunction
(SOAP_FUNCTIONS_ALL
);
$soap
->
handle
();
function
minus_func
($i
,
$j
){
$res
=
$i
-
$j
;
return
$res
;
}
//client¶Ë
clientSoap.php
try
{
$client
=
new
SoapClient
(null
,
array
('location'
=>
"http://192.168.1.179/test/serverSoap.php"
,
'uri'
=>
"http://127.0.0.1/"
)
);
echo
$client
->
minus_func
(100
,
99
);
}
catch
(SoapFault
$fault
){
echo
"Error: "
,
$fault
->
faultcode
,
", string: "
,
$fault
->
faultstring
;
}
ÕâÊǿͻ§¶Ëµ÷Ó÷þÎñÆ÷¶Ëº¯ÊýµÄÀý×Ó£¬ÎÒÃÇÔÙ¸ã¸öclassµÄ¡£
//server¶Ë
serverSoap.php
$classExample
=
array
();
$soap
=
new
SoapServer
(null
,
array
('uri'
=>
"http://192.168.1.179/"
,
'classExample'
=>
$classExample
));
$soap
->
setClass
('chesterClass'
);
$soap
->
handle
();
class
chesterClass
{
public
$name
=
'Chester'
;
function
getName
Ïà¹ØÎĵµ£º
/***************************by
garcon1986********************************/
<?php
//if Óï¾ä
$a = $b = 3;
if($a = $b)
print "a is equal to b<br>";
//else Óï¾ä
if($a < $b){
print "a is smaller than b";
} else {
print "a is not smaller than b<br> ......
/***************************by
garcon1986********************************/
<?php
//php avancé 5 example
$a = 'hello';
$a .= 'world';
$table = 'users';
$id = 5;
$sql = 'SELECT * from'.$table. "WHERE ID = '$id'";
//date() GÏÔʾ24СʱµÄ¸ñʽ£¬iÏÔʾ·ÖÖÓ
echo 'il est'.date( ......
/***************************by garcon1986************************************/
<?php
error_reporting(E_ALL ^ E_NOTICE);
//create database test
//create table php_radio(id int(10) NOT NULL AUTO_INCREMENT, name varchar(100), description varchar(1000), primary key(id));
//insert php_radio value ......
ÏîÄ¿ÉèÏë
ѧУ¸÷²¿ÃŵÄÍøÕ¾²¢·ÇÓõÄÒ»Ì×cmsϵͳ£¬ÐÐÕþ²¿ÃÅÓë¶þ¼¶Ñ§ÔºµÄÍøÕ¾ÊýÁ¿ÖÚ¶àÇÒ¿ª·¢ÈËÔ±µÄˮƽ²Î²î²»Æë£¬µ¼ÖÂÐÅÏ¢¼Ü¹¹±È½Ï»ìÂÒ¡£Í¨¹ýÒ»¸öÈ«¾ÖµÄ¹¤¾ßÌõʵÏÖȫУվµãÁ´½ÓÓ빫¸æ¶¯Ì¬¸üУ¨ÄÜÔÚÈκÎÒ»¸ö×ÓÕ¾µã¿´µ½×îÐµĹ«¸æ£©µÄ¹¦ÄÜ¡£
¹«¸æÄ£¿éÊý¾Ý¿âÉè¼Æ(Êý¾Ý¿â:globaltools)
Ê×ÏÈ´´½¨Ò»¸ö±íannouncement£¬°üÀ¨Ëĸö× ......
SESSIONµÄʹÓÃ
SESSIONµÄ×÷Óúܶ࣬×î¶àÓõľÍÊÇÕ¾µãÄÚÒ³Ãæ¼ä±äÁ¿´«µÝ¡£ÔÚÒ³Ãæ¿ªÊ¼ÎÒÃÇÒªsession_start();
¿ªÆôSESSION£»
È»ºó¾Í¿ÉÒÔʹÓÃSESSION±äÁ¿ÁË£¬±ÈÈç˵Ҫ¸³Öµ¾ÍÊÇ£º$_SESSION['item']="item1";ÒªµÃµ½Öµ¾Í
ÊÇ$item1=$_SESSION['item'];£¬ºÜ¼òµ¥°É¡£ÕâÀïÎÒÃÇ¿ÉÄÜ»áʹÓõ½Ò»Ð©º¯Êý£¬±ÈÈç˵ÅжÏÊDz»ÊÇ
ijSESSION±ä ......