本文介绍了C#客户端-PHP Web服务器-Couchbase数据库-如何在它们之间传递数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图理解一个系统的基本流程,该系统包括:

I am trying to understand the basic flow of a system consisting of:

  1. C#客户端/程序/应用程序,它将查询 PHP 服务器.
  2. PHP 服务器.
  3. 在Linux上运行的
  4. Couchbase 服务器.
  1. C# client/program/app which will query the PHP server.
  2. PHP server.
  3. Couchbase server running on Linux.

在客户端,我有一些类, MyClass类{int,string,list等} .

On the client side I have some classes, class MyClass {int,string,list etc}.

基于其他问题和答案,流程应如下所示:

Based on other questions and answers, the flow should look like this:

C#客户端类->序列化为 JSON ->作为字符串发送到 PHP 页面->(在 PHP 页面)将 JSON 字符串反序列化为 PHP 类->发布到 Couchbase ->获取结果->序列化为 JSON ->以 JSON 字符串发布并返回到 C#客户端->等等

C# client class->serialize to JSON-> post as string to PHP page-> (on PHP page) deserialize JSON string to PHP class ->posting to Couchbase -> getting result -> serialize to JSON->post as JSON string and return to the C# client -> etc

  1. 那是正确的吗?有什么建议么?
  2. 最好的工具/软件包是什么,从 JSON 进行序列化并在 PHP 中转换为 JSON 的最简单方法是什么?
  1. Is that correct? Any suggestions?
  2. What are the best tools/packages, easiest way to serialize from JSON and to JSON in PHP?

感谢您的帮助!

推荐答案

Couchbase 2.0是一个数据库,可用于直接存储文档.有了JSON字符串后,您就可以使用PHP客户端SDK将其存储到Couchbase中.

Couchbase 2.0 is a database that allows you to store document directly. As soon as you have the JSON string you can store it into Couchbase using the PHP Client SDK.

也就是说,如果您有一个PHP对象,则可以使用PHP中提供的json_encode()/json_decode()函数.

That said, if you have a PHP object and you can use the json_encode()/json_decode() functions that are available in PHP.

您可以查看Couchbase的入门和教程:- http://www.couchbase.com/docs/couchbase-sdk-php-1.1/tutorial.html

You can take a look the the Getting Started and Tutorial from Couchbase:- http://www.couchbase.com/docs/couchbase-sdk-php-1.1/tutorial.html

您还可以查看这个有趣的库,该库使您可以轻松地使用PHP和Couchbase进行开发:- https://github.com/Basement/Basement 您可以使用它,也可以查看它如何使用PHP和JSON.

Also you can look at this interested library that allows you to develop with PHP and Couchbase easily:- https://github.com/Basement/BasementYou can look to use it, or look to see how it uses PHP and JSON.

这篇关于C#客户端-PHP Web服务器-Couchbase数据库-如何在它们之间传递数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 10:39