php solve cross-domain code

Today afternoon to engage in a variety of Baidu. Say what configuration apache. In fact, I make things complicated.

In fact, only you need to add the following code to write in their own php file inside

<?php

// allow the development of other domain names

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

// response type

header('Access-Control-Allow-Methods:POST');

// response header

header('Access-Control-Allow-Headers:x-requested-with, content-type');

?>

  Record your own sad history

Guess you like

Origin www.cnblogs.com/ayong6/p/12238545.html