我有一个PHP函数类,它必须在跨服务器上工作。因此,我进行了搜索并决定尝试不使用WSDL的SOAP,它的工作原理很吸引人。但是,如果一页中有5-6个以上的函数调用($ soap-> function()),则生成结果的速度确实很慢。因此,如何像一次调用CLASS一样运行该SOAP代码,并使所有功能保持静态。有办法吗?还是应该使用什么代替SOAP?
calling.php
$options = array(
"uri" => "https://globalurl",
"location" => "https://globalurl/soapserver.php",
);
$soap = new SoapClient(null, $options);
$header = new SoapHeader('https://globalurl', 'soapAuth', 'AUTHCODE.KEY', false, SOAP_ACTOR_NEXT);
$soap->__setSoapHeaders($header);
print_r($soap->hashFunction('XXX'));
print_r($soap->siteFunction('XXX'));
print_r($soap->encryptFunction('XXX', '', 2));
print_r($soap->decryptFunction('XXX','', 2));
print_r($soap->remoteIPFunction());
soapserver.php
class soapGlobal {
public function __construct() {
}
public static function hashFunction() {
//some function...
}
public static function siteFunction() {
//some function...
}
public static function encryptFunction() {
//some function...
}
public static function decryptFunction() {
//some function...
}
public static function remoteIPFunction() {
//some function...
}
//some more function...
}
$server = new SoapServer(null, array("uri" => "https://globalurl"));
$server->setClass("soapGlobal");
$server->handle();
我需要我的代码仅调用跨服务器函数类并使用它,而又没有所有延迟时间。预先谢谢你...