$.getJSON(
'http://121.42.193.175/player/tp5/public/api.php',
function(data) {
alert(data);
}
);服务器代码如下<?php
namespace app\index\controller;
class Index
{
public function index()
{
return "[{'name':'1'}]";
}
}
?>入口文件有header('Access-Control-Allow-Origin:*');通过浏览器直接访问这个地址可以, 但是放在APP里面访问就不行了, 直接在浏览器运行上面的JS也不行, 所以我怀疑是跨域的问题, 但是不会解决,报这样的错误:Failed to load resource: the server responded with a status of 500 (Internal Server Error)
而且我在APP 请求一个没有经过TP5的页面可以正常请求
求大神帮助
最佳答案