解决 ajax传值到PHP后台,如何获取值

前端代码


formData 传值后台,接收方法。

header('Access-Control-Allow-Origin:*');

header('Access-Control-Allow-Methods:OPTIONS, GET, POST'); // 允许option,get,post请求

header('Access-Control-Allow-Headers:x-requested-with'); // 允许x-requested-with请求头

header('Content-type: application/json');

header("Content-type:text/html;charset=utf-8");


$data = $_POST;

$data['files'] = $_FILES;

echo $data;

?>

你可能感兴趣的:(解决 ajax传值到PHP后台,如何获取值)