如何从android发送字符串和图像到PHP [英] How to send strings and images from android to php

查看:67
本文介绍了如何从android发送字符串和图像到PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何将字符串和图像从android发送到php(更优选JSON)

Hi,

How to send strings and images from android to php (JSON would be more preferable)

推荐答案

您肯定需要使用某些网络将数据从Android共享到以PHP语言运行的网站。 PHP方面对于Android来说完全不相关,因为PHP将作为服务器端语言处理,而Android无意关注它。 Android只关心发送数据并获得响应。



第一种方法可以使这个过程尽可能简单。怎么会这样?那就是在Android应用程序中加载网站的网页。就像在任何.NET应用程序中使用WebBrowser一样,您可以使用WebView使用Android的默认浏览器下载网页,然后在屏幕上呈现它。这是一种简单的方法,因为您不必编写任何代码来上传或下载数据。您所要做的就是创建一个简单的HTML页面,其事件将使用PHP脚本语言进行控制。对于这种方法,您会感兴趣(并且会发现有助于移动)阅读此 Android开发人员指南页 [ ^ ]。您将找到创建此类应用程序的完整指南。如果您不是专家,最好使用内置函数。



您可以使用JSON表示法来传输数据。正如我已经说过的,Android不会关心运行在服务器端语言类型上的网站类型的数据类型。它所关心的只是要发送的数据,以及通过网络接收的数据。您当然可以将该数据转换为JSON表示法。如果你想学习JSON,你应该去 http://json.org/ [ ^ ]。
You would definitely need to work with some networks for sharing the data from Android to a website that is running in PHP language. PHP side is totally un-relational for the Android, because PHP would be handled as a server-side language which Android has no intention to care about. Android would just care about sending the data and getting the response.

The first approach can be to make this process as simple as possible. How that can happen? That would be to load the website's web page in the Android application. Just like using the WebBrowser in any .NET application, you can use the WebView for downloading the web pages using the Android's default browser and then rendering it over the screen. It is a simple way, because you won't have to write any code for uploading, or downloading the data. All you would have to do would be to create a simple HTML page whose events would be controlled using PHP scripting language. For this approach, you would be interested (and would find it helpfull to move) to read this Android developer guide page[^]. You will find entire guide for creating such an application. It is better to use the built-in functions if you're not an expert.

You can use the JSON notation, to transfer the data. As I have already said, Android won't care about the type of data from type of website running over type of server-side language. All it would care about would be the data to be sent, and the data that is being recieved over the network. You can surely convert that data to a JSON notation. If you want to learn JSON, you should go to http://json.org/[^].


这篇关于如何从android发送字符串和图像到PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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