【发布时间】:2020-02-05 14:45:50
【问题描述】:
我正在尝试使用 axios 将表单数据发送到 php 脚本。 axios 的语法是否正确? 如何查看通过 post 方法发送的数据?
我刚开始用 vuetify 和 php 编程,所以我需要一点帮助
methods: {
formSubmit(e) {
e.preventDefault();
let currentObj = this;
this.axios.post('http://localhost/index.php/',{
name : this.name, user : this.username
})
.then(function (response) {
currentObj.output = response.data;
})
.catch(function (error) {
currentObj.output = error;
});
},
}
在php文件中有:
<?php
require_once 'limonade.php';
$data = $_POST;
dispatch('/api/', 'test1');
function test1()
{
return 'Hello';
}
run();
【问题讨论】:
标签: php vue.js vuejs2 http-post vuetify.js