<bdo id='Uh8P9'></bdo><ul id='Uh8P9'></ul>
  • <legend id='Uh8P9'><style id='Uh8P9'><dir id='Uh8P9'><q id='Uh8P9'></q></dir></style></legend>

    <small id='Uh8P9'></small><noframes id='Uh8P9'>

        <tfoot id='Uh8P9'></tfoot>
        <i id='Uh8P9'><tr id='Uh8P9'><dt id='Uh8P9'><q id='Uh8P9'><span id='Uh8P9'><b id='Uh8P9'><form id='Uh8P9'><ins id='Uh8P9'></ins><ul id='Uh8P9'></ul><sub id='Uh8P9'></sub></form><legend id='Uh8P9'></legend><bdo id='Uh8P9'><pre id='Uh8P9'><center id='Uh8P9'></center></pre></bdo></b><th id='Uh8P9'></th></span></q></dt></tr></i><div id='Uh8P9'><tfoot id='Uh8P9'></tfoot><dl id='Uh8P9'><fieldset id='Uh8P9'></fieldset></dl></div>

        将整数和文本字符串等数据从手机发送到网络数据库

        Sending data such as integers and text strings from a phone to a web database(将整数和文本字符串等数据从手机发送到网络数据库)

        <legend id='vY5hd'><style id='vY5hd'><dir id='vY5hd'><q id='vY5hd'></q></dir></style></legend>
            <bdo id='vY5hd'></bdo><ul id='vY5hd'></ul>
              <tfoot id='vY5hd'></tfoot>
                <tbody id='vY5hd'></tbody>
                <i id='vY5hd'><tr id='vY5hd'><dt id='vY5hd'><q id='vY5hd'><span id='vY5hd'><b id='vY5hd'><form id='vY5hd'><ins id='vY5hd'></ins><ul id='vY5hd'></ul><sub id='vY5hd'></sub></form><legend id='vY5hd'></legend><bdo id='vY5hd'><pre id='vY5hd'><center id='vY5hd'></center></pre></bdo></b><th id='vY5hd'></th></span></q></dt></tr></i><div id='vY5hd'><tfoot id='vY5hd'></tfoot><dl id='vY5hd'><fieldset id='vY5hd'></fieldset></dl></div>

                  <small id='vY5hd'></small><noframes id='vY5hd'>

                1. 本文介绍了将整数和文本字符串等数据从手机发送到网络数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个项目,我应该将整数、浮点数和文本字符串等数据从 Android 应用程序发送到网络数据库.但是,我没有关于如何执行此操作的第一个线索.有人可以对此有所了解吗???任何建议或帮助将不胜感激.

                  I have a project where I'm supposed to send data such as integers, floats and text strings from an android app to a web database. However I don't have the first clue on how to do this. Could somebody shed some light on this please??? Any advise or help would be much appreciated.

                  推荐答案

                  1. 您需要编写一些服务器端逻辑(通过 POST 或 GET 方法接受参数 key=value 的 PHP 页面)
                  2. 然后,如果数据经过验证,则将其保存到数据库中
                  3. 在手机中,您必须实现 HttpClient 和 HttpPost 类才能将此数据发布到 PHP 页面

                  在手机中,您可以使用以下代码(未测试):

                  In phone you can use following code (no tested):

                      public void postData() {
                      // Create a new HttpClient and Post Header
                      HttpClient httpclient = new DefaultHttpClient();
                      HttpPost httppost = new HttpPost("http://www.yoursite.com/script.php");
                  
                      try {
                          // Add your data
                          List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
                          nameValuePairs.add(new BasicNameValuePair("id", "12345"));
                          nameValuePairs.add(new BasicNameValuePair("stringdata", "Hi"));
                          httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                  
                          // Execute HTTP Post Request
                          HttpResponse response = httpclient.execute(httppost);
                  
                      } catch (ClientProtocolException e) {
                          // TODO Auto-generated catch block
                      } catch (IOException e) {
                          // TODO Auto-generated catch block
                      }
                  } 
                  

                  在 PHP 中你可以这样做:

                  In PHP you can do something like this:

                  <?php
                  //Check whether the data has been submitted
                  if (isset($_POST['id'] && isset($_POST['stringdata'])) ) {
                  
                     //Let's now print out the received values in the browser
                     echo "Id: {$_POST['id']}<br />";
                     echo "String data: {$_POST['stringdata']}<br />";
                  
                     //you can implement database logic here too (insert data to database)
                  } else {
                      echo "You can't see this page without submitting the data.";
                  }
                  ?>
                  

                  这篇关于将整数和文本字符串等数据从手机发送到网络数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  <i id='k8ivr'><tr id='k8ivr'><dt id='k8ivr'><q id='k8ivr'><span id='k8ivr'><b id='k8ivr'><form id='k8ivr'><ins id='k8ivr'></ins><ul id='k8ivr'></ul><sub id='k8ivr'></sub></form><legend id='k8ivr'></legend><bdo id='k8ivr'><pre id='k8ivr'><center id='k8ivr'></center></pre></bdo></b><th id='k8ivr'></th></span></q></dt></tr></i><div id='k8ivr'><tfoot id='k8ivr'></tfoot><dl id='k8ivr'><fieldset id='k8ivr'></fieldset></dl></div>
                2. <tfoot id='k8ivr'></tfoot>

                  <small id='k8ivr'></small><noframes id='k8ivr'>

                3. <legend id='k8ivr'><style id='k8ivr'><dir id='k8ivr'><q id='k8ivr'></q></dir></style></legend>
                    <tbody id='k8ivr'></tbody>

                      <bdo id='k8ivr'></bdo><ul id='k8ivr'></ul>