用webService吧,远程调用...唔唔..

解决方案 »

  1.   

     可以用PHP的service 框架nusoap ...使用方法可以百度或谷歌一下..
     也可以自己设计:
     
     //客户端的service请求:
     try {
        $client = new SoapClient(null,
        array('location' => 'http://localhost/mvc/application/soap/soap_server.php',//存放service服务端处理地址
        'uri' => 'http://wso2.org/wsf/php/helloService'));   
        $result = $client->__soapCall('includeFiles', array('../models/testModel.php'));//函数调用方法一
        $result .= $client->test();//函数调用方法二
        printf("Result = %s", $result);
    } catch (SoapFault $e) {
        printf("Message = %s",$e->getMessage());
    }//--------------------------------------------------------------- //服务端的service处理:
    function includeFiles($param) {
       require_once("{$param}");
    }function test(){
    return "<b>xxx</b>";
    }$server = new SoapServer(null, array('uri' => 'http://wso2.org/wsf/php/helloService'));
    $server->addFunction(array('includeFiles','test'));
    $server->addFunction('includeFiles');
    $server->addFunction('test');
    $server->handle();