作为程序员一定要保持良好的睡眠,才能好编程

一篇开发接口注意事项及说明

发布时间:2018-07-06

开发接口,什么是接口,做什么用的?


开发接口注意事项?


开发接口提交header头是什么?



服务器端有集中方式获取客户端信息?


X-Requested-With:XMLHttpRequest

Content-Type:application/json
服务端   file_get_contents('php://input');  然后再 json_decode($result);


Content-Type:application/x-www-form-urlencoded;charset=UTF-8
服务端  $_POST  or $_GET


服务端支持跨域:

header('Content-type:text/html;charset=utf-8');
$origin = '*';
header('Access-Control-Allow-Methods: GET, POST');
header('Access-Control-Allow-Headers: X-Requested-With, Uni-Source, X-Access-Token');
header('Access-Control-Allow-Origin: ' . $origin);
$origin === '*' || header('Access-Control-Allow-Credentials: true'); //withCredentials