thinkcmf同样的访问连接,浏览器和app访问的返回结果不同?
用thinkcmf作为后台,app作为前端,api调用接口为
http://192.168.1.109/projectonline/index.php?g=&m=AdminNet&a=getNets_json
API如下:
public function getNets_json() {
$nets = $this->nets_model->order("id")->getField("id, name, imgid", true);
$this->apiReturn(200,'读取用户信息成功',json_encode(array('nets'=>$nets)), 'json');
}
APP获取方法:
URL url = new URL(urlPath);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("GET");
conn.setUseCaches(false);
InputStream inStream = conn.getInputStream();
用浏览器访问可以返回json格式的数据,但用android app访问,却跳到网站的前端页面内容http://192.168.1.109/projectonline