简体   繁体   English

PHP Server是否可以在任何语言平台上为客户提供服务?

[英]PHP Server to serve clients on ANY language platform?

I need to have a data supply Server with PHP to serve (returning data to) any Client Applications from any universal programming language platforms like, ie Java, .NET, Python, iOS, C#, C++, etc. 我需要一个带有PHP的数据供应服务器,以从任何通用编程语言平台(例如Java,.NET,Python,iOS,C#,C ++等)提供服务(将数据返回)到任何客户端应用程序。

First few questions would be: 前几个问题是:

  • Would that one be even called API or Web Service? 甚至可以将其称为API或Web服务吗?
  • If Web Service, which one should it be? 如果是Web Service,应该是哪一个? (In PHP Docs, the WebServices are OAuth, SCA, SOAP, XML-RPC) (在PHP Docs中,Web服务是OAuth,SCA,SOAP,XML-RPC)

Then which particular approach should i use? 那我应该使用哪种方法呢? (in such common scenarios) Which PHP implementation would be make the Server to communicate with ANY MAJOR programming platforms? (在这种常见情况下)服务器将使用哪种PHP实现与任何主要的编程平台进行通信?

Its a webservice (btw you are a bit confused about what is an API layered on top of a web-service) 它是一个Web服务(顺便说一句,您对位于Web服务之上的API有点困惑)

As for formatting the data....that's up to you. 至于格式化数据...。这取决于您。

SOAP - is a very formal and complex method of describing data and metadata - which is computationally expensive on both client and server. SOAP-是描述数据和元数据的非常正式和复杂的方法-客户端和服务器上的计算量都很大。 It defines both the request as well as the response 它定义了请求和响应

XML-RPC is a simpler system based on XML - again request and response are XML XML-RPC是一个基于XML的简单系统-再次,请求和响应都是XML

JSON is increasingly widespread - much simpler. JSON越来越广泛-更简单。

Serialized PHP is also comonplace (there are tools available for C#, Java, Ruby, Python...) 序列化的PHP也很常见(有一些工具可用于C#,Java,Ruby,Python ...)

At the end of the day, they ALL USE TEXT to comunicate - hence will work with ANY MAJOR programming platform (even if they used binary data, its still data hence should be parseable by anything which can talk HTTP). 归根结底,他们都使用TEXT进行通讯-因此将可以在任何主要的编程平台上使用(即使他们使用了二进制数据,其静态数据也应该可以被任何可以说HTTP的东西解析)。

IMHO SOAP is somewhat overcomplicated unless you're trying to keep systems in sync using evolving APIs. 除非您尝试使用不断发展的API使系统保持同步,否则IMHO SOAP会有些复杂。 YAML is...only for Ruby programmers. YAML仅适用于Ruby程序员。 Serialized PHP is easy to implement but difficult to document. 序列化的PHP易于实现,但难以记录。 If it were me, I'd go with JSON (do have a google for JSON schema). 如果是我,我会使用JSON(有一个用于JSON模式的Google)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM