从应用程序在服务器上存储数据 [英] storing data on a server from an app

查看:148
本文介绍了从应用程序在服务器上存储数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从iOS应用程序在服务器上存储数据?

How does one store data on a server from an iOS app?

如果我创建,例如一个JSON对象,如何将其发送到服务器并将其作为某个Key的值保存在服务器上?

If I create, e.g. a JSON object, how can I send this to the server and save it on the server as the value from some Key?

我现在正在使用MAMP并且已经看到了如何在服务器上创建项目并将其发送到手机的示例,我想学习如何在设备上创建对象,将它们发送到服务器进行存储。例如JSON对象,并将其作为例如存储在服务器上的值存储在服务器上。带有ID的密钥。

I am using MAMP at the moment and have seen examples of how to create the item on the server and get it to the phone, I would like to learn how to create objects on the device, send them to the server for storage. such as a JSON object and store it on the server as a value for e.g. a key with an ID.

我非常感谢任何帮助。

推荐答案

查看 ASIHTTPRequest 。它可以异步GET / POST从URL进行存储,如果数据集足够小,可以查看 NSUserDefaults

Check out ASIHTTPRequest. It can GET/POST from a URL asynchronously and for storage, if the data set is small enough look at NSUserDefaults.

在服务器端(如果脚本是PHP),你可以处理$ _POST和$ _GET变量中的数据,就好像它们是从网络上填充一样。

On the server side (if the scripts are PHP), you can handle the data in the $_POST and $_GET variables just as if they were populated from the web.

如果你想要,你可以在他们自己的$中单独发布变量_POST或$ _GET变量,或作为1个JSON字符串,您可以解码当你收到它时。

If you wanted you could post the variables individually in their own $_POST or $_GET variables, or as 1 JSON string which you could decode when you receive it.

这篇关于从应用程序在服务器上存储数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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