PHP SOAP 和 NuSOAP 哪个更好?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15402233/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Which is better PHP SOAP or NuSOAP?
提问by Abdul Vahaf
Which is better PHP SOAP or NuSOAP ? Please help me out ?
PHP SOAP 和 NuSOAP 哪个更好?请帮帮我?
回答by Raptor
PHP SOAPis available since PHP 5.0.1 . If you are in PHP4, you have to use NuSOAP.
PHP SOAP从 PHP 5.0.1 开始可用。如果您使用的是 PHP4,则必须使用NuSOAP。
Native PHP codes are usually better in performance & relatively bug free, so if PHP SOAP is available, use it. More, NuSOAP has not much documentation on their official website.
原生 PHP 代码通常具有更好的性能且相对无错误,因此如果 PHP SOAP 可用,请使用它。而且,NuSOAP 在他们的官网上没有太多的文档。
回答by hpaknia
Although there is some nuance to mention, I think NuSoap is better:
虽然有一些细微差别要提及,但我认为 NuSoap 更好:
- Nusoap has some predefined methods that in case of using Soap you should write some of your own.
- because SOAP performance bottleneck is server response time, there is no fear to use a predefined class Like Nusoap.
- Handling UTF-8 is a lot more easy in Nusoap.
- Nusoap offers some good functions to create a SOAP server.
- Nusoap 有一些预定义的方法,在使用 Soap 的情况下,您应该编写一些自己的方法。
- 因为 SOAP 的性能瓶颈是服务器响应时间,所以不用担心使用像 Nusoap 这样的预定义类。
- 在 Nusoap 中处理 UTF-8 更容易。
- Nusoap 提供了一些很好的功能来创建 SOAP 服务器。
回答by Kiran Kadali
Using nusoap, no need to write the WSDL file
使用nusoap,无需编写WSDL文件
回答by I?igo Panera
Nusoap is no longer maintained. It is supported up to version 4.X of PHP. Newer versions can start giving problems
不再维护 Nusoap。最高支持 PHP 4.X 版。较新的版本可能会开始出现问题
回答by kouwen
Another advantage of using Nusoap is that the result you get is already in an array. Normal PHP you get an object and you need to convert into an array yourself. and I did a small bench mark Nusoap is micro seconds faster than my own implementation including converting into an array. Nusoap = -1370852340.1761 Native PHP = -1370852340.2057
使用 Nusoap 的另一个好处是你得到的结果已经在一个数组中。普通的 PHP 你得到一个对象,你需要自己转换成一个数组。我做了一个小的基准测试 Nusoap 比我自己的实现快微秒,包括转换为数组。Nusoap = -1370852340.1761 原生 PHP = -1370852340.2057
public function objectToArray($obj)
{
if(!is_array($obj) && !is_object($obj))
return $obj;
if(is_object($obj))
$obj = get_object_vars($obj);
return array_map(array($this, 'objectToArray'), $obj);
}

