動機
做介面給其他地方接,預想是讓pandan可以輸出資料
開始
Server 端測試
<?php
class ap
{
function geta()
{
return 'return a!';
}
}
function getb($name)
{
return 'return b!';
}
$server = new SoapServer(null,array("uri"=>"http://localhost/","location"=>"http://localhost/webserver/server.php"));
$server->setClass('ap');
//$server->addFunction('getb');
$server->handle();
?>
Client 端測試
<?php
$soap = new SoapClient(null, array('location'=>'http://192.168.1.1/webservice/server.php','uri'=>'http://192.168.1.1/'));
echo $soap->geta();
紀錄一下
問題
Class 'SoapServer' not found
編譯的時候帶參數--enable-soap目前為止有用到的編譯參數
./configure --prefix=/opt/php --with-apxs2=/opt/httpd/bin/apxs --with-pear=/opt/pear --with-curl=shared --with-mcrypt=shared --enable-bcmath=shared --enable-mbstring=shared --enable-soap=shared --enable-sysvshm=shared --enable-opcache=shared --with-mysqli=shared --with-mysql=shared --with-snmp=shared --enable-soap
留言
張貼留言