Answer the question
In order to leave comments, you need to log in
Why is the php file not working in vue/nuxt?
Good afternoon.
In my project, I need to change my local json file, I have it in the static / data.json folder.
There is also a php file in the static folder of this type:
<?php
$data = $_POST['data'];
fopen('data.json', 'w+');
// fwrite($file, $data);
file_put_contents('data.json', null);
fclose('data.json');
print('xyu');
?>
sendJson() {
axios.post('test.php', this.DATAMAIN )
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
}
Answer the question
In order to leave comments, you need to log in
Please tell me what is the problem
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question