国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - axios upload data to php returns empty
過去多啦不再A夢
過去多啦不再A夢 2017-06-20 10:05:38
0
2
1082

1.vue 2.0 uses axios to upload data and returns empty, and the background is php

2.vue code

saveEssay(){
        console.log(this.titleData);
        this.axios({
          method: 'post',
          url:'XXX',
          data: {
            title: this.titleData,
            tags: this.tagsData,
            content:this.contentData,
            isPublish:0
          }
        })
          .then(function (response) {
            console.log(response);
          })
          .catch(function (error) {
            console.log(error);
          })
      },

3.php code

<?php
header('Content-type:text/html;charset=utf8');  
header('Access-Control-Allow-Origin:*');  
 
header('Access-Control-Allow-Methods:POST');  

header('Access-Control-Allow-Headers:x-requested-with,content-type');  
$mysqli=new mysqli();
$mysqli->connect('xxx','xxx','xxx','xxx');
if (mysqli_connect_errno($mysqli))
{
    echo "連接 MySQL 失敗: ";
}
$v1=$_REQUEST['title'];
$v2=$_REQUEST['tags'];
$v3=$_REQUEST['content'];
$v4=$_REQUEST['isPublish'];
 echo $v1.$v2.$v3.$v4
?> 

4.console returns data

   ![圖片描述][1]

5. Remarks
Get data is valid. Post submission data cannot be obtained for some reason in the php page, and the return is empty. The html page can be accessed and can also be inserted into the database, but it is empty. And it is possible to simply upload data to php using jQuery. The only difference between the two is the method of uploading data. Ask God for answers

過去多啦不再A夢
過去多啦不再A夢

reply all(2)
我想大聲告訴你

file_get_contents("php://input")

曾經(jīng)蠟筆沒有小新

Search to Baidu and PHP cannot obtain data in json format

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template