php后台解决跨域

protected function _initalize()
{
header("content-type:text/html;charset=utf-8");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers:Origin,X-Requested-With,Content-Type,Accept");
header("Access-Control-Allow-Methods:GET,POST,PUT");
ksort($_POST);
ksort($_GET);
}

以上是php7.0,如果遇到跨域问题,也可能是php版本问题

原文地址:https://www.cnblogs.com/init-007/p/12643275.html