[Vuejs]-Vue Resource empty data

0👍

I’m not too familiar with PHP, but I’ll give it a go.

The $_POST variable only contains data from the request when the HTML Content-Type of the request is application/x-www-form-urlencoded or multipart/form-data. vue-resource by default sets the Content-Type of the request to application/json.

If you want to access JSON data in your PHP script, you’ll have to decode the request data from JSON. See Receive JSON POST with PHP.

Leave a comment