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

    <bdo id='uBgav'></bdo><ul id='uBgav'></ul>
  • <small id='uBgav'></small><noframes id='uBgav'>

  • <tfoot id='uBgav'></tfoot>

    1. <legend id='uBgav'><style id='uBgav'><dir id='uBgav'><q id='uBgav'></q></dir></style></legend>

        axios POST上的PHP Post数组为空

        PHP Post array empty on axios POST(axios POST上的PHP Post数组为空)
              <i id='Eoa9W'><tr id='Eoa9W'><dt id='Eoa9W'><q id='Eoa9W'><span id='Eoa9W'><b id='Eoa9W'><form id='Eoa9W'><ins id='Eoa9W'></ins><ul id='Eoa9W'></ul><sub id='Eoa9W'></sub></form><legend id='Eoa9W'></legend><bdo id='Eoa9W'><pre id='Eoa9W'><center id='Eoa9W'></center></pre></bdo></b><th id='Eoa9W'></th></span></q></dt></tr></i><div id='Eoa9W'><tfoot id='Eoa9W'></tfoot><dl id='Eoa9W'><fieldset id='Eoa9W'></fieldset></dl></div>

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

              <tfoot id='Eoa9W'></tfoot>
              • <bdo id='Eoa9W'></bdo><ul id='Eoa9W'></ul>

                • <legend id='Eoa9W'><style id='Eoa9W'><dir id='Eoa9W'><q id='Eoa9W'></q></dir></style></legend>
                    <tbody id='Eoa9W'></tbody>
                  本文介绍了axios POST上的PHP Post数组为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在试用 Vue 2.0 和 axios,但遇到了一个小问题.当我尝试使用 axios 向我的 post.php 文件发送 post 请求时,$_POST 数组始终为空.

                  I'm trying out Vue 2.0 and axios and I've got a little issue. When I try to send a post request using axios to my post.php file the $_POST array is always empty.

                  发布功能:

                  doPost: function() {
                    console.log("post in progress")
                    axios.post('api/post.php', {
                        title: 'foo',
                        body: 'bar',
                        userId: 1
                    })
                    .then(response => {
                      console.log(response)
                      console.log(response.data)
                      this.filter = response.data
                    })
                    .catch(e => {
                      this.errors.push(e)
                    })
                  }
                  

                  post.php

                  <?php
                  header('Content-Type: application/x-www-form-urlencoded');
                  
                  
                  echo json_encode($_POST);
                  ?>
                  

                  请求以状态 200 完成,但返回一个空对象[]"

                  The request is completed with status 200 but returns an empty object "[]"

                  注意:当我将 post 端点更改为 jsonplaceholder 工具时,它工作正常.

                  Note: when I change the post endpoint to jsonplaceholder tool it works fine.

                  推荐答案

                  我觉得你可以试试这个,应该是数据类型的问题.

                  I think you can try this, it should be the data-type problem.

                  var data = new FormData();
                  data.append('title', 'foo');
                  data.append('body', 'bar');
                  
                  axios.post('api/post.php', data)
                      .then(response => {
                          console.log(response)
                          console.log(response.data)
                          this.filter = response.data
                      })
                      .catch(e => {
                          this.errors.push(e)
                  });
                  

                  这篇关于axios POST上的PHP Post数组为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)

                    1. <small id='8QNOi'></small><noframes id='8QNOi'>

                      <legend id='8QNOi'><style id='8QNOi'><dir id='8QNOi'><q id='8QNOi'></q></dir></style></legend>

                          <tbody id='8QNOi'></tbody>
                        • <tfoot id='8QNOi'></tfoot>

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