PHP Web 服务初学者 [英] Beginner to PHP web services

查看:27
本文介绍了PHP Web 服务初学者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 PHP 中实现 Web 服务的最佳方法是什么?

What is the best way to implement web services in PHP?

我听说过诸如 NuSOAPWSO2 网络服务平台之类的库,但不知道使用网络的最佳(或易于学习)是什么PHP 中的服务?

I have heard about libraries like NuSOAP and WSO2 web service platform, but don't know what is the best (or good and easy to learn) for using web service in PHP?

推荐答案

SOAP 当然不是实现 Web 服务的唯一方法.如果您对其他范式持开放态度,请查看 REST.

SOAP is certainly not the ONLY way to implement Web services. If you're open to other paradigms, have a look at REST.

与 SOAP(具有多个标准/供应商)不同,REST 与供应商和协议无关.相反,RESTful Web 服务是使用以下指南实现的(来自维基百科文章):

Unlike SOAP (which has multiple standards/vendors), REST is both vendor- and protocol-agnostic. Instead, RESTful Web services are implemented using these guidelines (from the Wikipedia article):

一个 RESTful Web 服务(也称为RESTful Web API) 是一个简单的 Web使用 HTTP 和REST 的原则.这样的网络服务可以认为是一个集合的资源.这样的定义Web 服务可以被认为是包括三个方面:

A RESTful web service (also called a RESTful web API) is a simple web service implemented using HTTP and the principles of REST. Such a web service can be thought about as a collection of resources. The definition of such a web service can be thought of as comprising three aspects:

* The base URI for the web service, such as http://example.com/resources/
* The MIME type of the data supported by the web service. This is often JSON, XML or YAML but can be any other valid MIME type.
* The set of operations supported by the web service using HTTP methods (e.g., POST, GET, PUT or DELETE).

回到 PHP,这里是参考指南用于 REST 服务器功能的 ZendFramework 实现.

Back to PHP, here is the reference guide for the ZendFramework implementation of REST Server functionality.

另外,这里是我给出的另一个答案的链接关于 ZendFramework 和 REST 的一些有用信息.

Also, here is a link to another answer I gave that references some useful information regarding ZendFramework and REST.

这篇关于PHP Web 服务初学者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆