本地开发页面模拟接口数据使用Php,遇到跨域问题,加上 <?php 到 ?> 这一段解决
<?php
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请求头
?>
{
"code": 0,
"appEnvs" : [
"trunk","neibu","release","product"
]
}